/*
 * @Author: hejian@myhexin.com
 * @Date: 2018-12-28 17:15:03
 * @Last Modified by: hejian@myhexin.com
 * @Last Modified time: 2019-04-08 13:47:44
 */
$(function () {
  // 禁止主题模式修改
  thscThemeObj.needChangeFlag = false;
  // 注册 hxmui 并固定白板主题模式
  Vue.use(window.hxmui, {
    themeMode: 'light'
  }).use(window.feeHelper);

  const UPDATE_MONITOR_LOCAL_KEY = location.href.replace(/\W/g, '') + 'UPDATE_MONITOR';

  var vueInit = null
  vueInit = new Vue({
    // 变量在mixin.js里面
    mixins: [meter, __data__],
    el: '#vuewrap',
    data: {
      isAddWeChat: true, //是否已经添加网销微信
      dlText: '添加专属产品顾问，领高阶战法',
      // 顶部的提示
      marquee: {
        animate: false,
        list: [],
        close: false,
        timer: null,
      },
      // 判断是否是安卓app
      androidApp: getPlatform() == 'gphone' ? true : false,
      // 亿的单位
      yi: 100000000,
      // 万的单位
      wan: 10000,
      // 是否展示问财机器人
      showWencai: false,
      // 问财问句列表
      askTextList: [],
      // 潜力连板个股名称列表-用于问财问句兜底
      qlgStockNameList: [],
      // 当前展示问句index（因为是滚动展示的）
      askTextShowIndex: 0,
      // 底部的tab名字
      tabs: ['涨停概要', '涨停复盘', '涨停基因', '涨停监控'],
      // 当前底部的tab
      currentTab: 0,
      // 涨停复盘的tab
      currentTag: 0,
      // 涨停基因的tab
      geneTab: 0,
      // 涨停监控的tab
      monitorTab: 0,
      // 是否显示canvas底部的极强极弱
      hasCanvas: false,
      // dpr
      dpr: $('html').data('dpr'),
      // 是否替代box-shadow
      isReplaceShadow: getPlatform() == 'gphone' && getOS().android - 0 < 6 ? true : false,
      // 底部tab切换loading动画的标志位
      loading2: true,
      loading3: true,
      loading4: true,
      /*------涨停概要的参数------*/
      // 储存的名字
      storageName: '__LIMITUPSUMMARY__',
      lastDayStorageName: '__LASTDAYNAME__',
      // 所有的涨停复盘数据
      allCompoundArr: {},
      allFaucetArr: {},
      summaryRefresh: false,
      // 今天的涨停复盘数据
      todayCompoundArr: {},
      todayFaucetArr: {},
      // 接口返回的最后一天
      lastDay: '',
      lastDay2: '',
      selDay: '',
      selDay2: '',
      //下一个交易日
      nextTradingDay: '',
      // 首页的数据
      indexSummaryData: {
        // 潜力
        potential: {
          sort: 'spj',
          arr: [],
          empty: false,
          potentialLoading: true
        },
        // 龙头
        faucet: {
          sort: 'spj',
          arr: [],
          empty: false,
          leaderLoading: true
        },
        // 是否集合竞价
        isUpdating: false,
        // 我的自选
        ownStock: [],
        // 我的资讯是否为空
        ownStockEmpty: false,
        // top3股票
        top3: [],
        // top3是否为空
        top3Empty: false,
        // 分数
        score: {},
        // 今日涨停概况
        headerState: {}
      },
      // 明日潜力的title名字
      potentialTitle: ['涨幅', '涨速', '连板数', '明日涨停概率', '最新价', '涨停原因'],
      // 市场龙头的title名字
      leaderTitle: ['最新价', '涨幅', '涨停原因', '连板数'],
      // 我的自选的title名字
      ownStockTitle: ['我的自选', '涨停基因', '最新价', '涨幅'],
      // 明日潜力连板个股旁边的提示
      summaryTips: false,
      /*------涨停复盘的参数--------*/
      // 涨停复盘
      compoundObject1: {
        current: [],
        detail: {},
        date: '',
        emptyData: false,
        advanceData: false
      },
      // 概念龙头
      faucetObject: {
        current: [],
        detail: {},
        date: '',
        emptyData: false,
        advanceData: false
      },
      // 3个池的接口请求标志位
      // 3个池是loading标志位
      // 3个池是否为空标志位
      pool1Flag: true,
      pool1Loading: true,
      pool1Empty: false,
      pool2Flag: true,
      pool2Loading: true,
      pool2Empty: false,
      pool3Flag: true,
      pool3Loading: true,
      pool3Empty: false,
      pool4Flag: true,
      pool4Loading: true,
      pool4Empty: false,
      pool5Flag: true,
      pool5Loading: true,
      pool5Empty: false,
      // 新股池的排序标志位及参数
      sortC1: -1,
      sortDirectionC1: ['', '', 'down', '', '', '', '', '', '', ''],
      defaultSortC1: {
        sort: 'hsl',
        lift: 1, //1降序 -1升序
        arr: 'poolArr1' //排序的数组
      },
      statSortC1: {
        flag: '',
        value: ''
      },
      sortNameC1: [{
          name: '最新价',
          sort: 'price'
        },
        {
          name: '涨跌幅',
          sort: 'upRise'
        },
        {
          name: '换手率',
          sort: 'hsl'
        },
        {
          name: '上市天数',
          sort: 'ssts'
        },
        {
          name: '开板天数',
          sort: 'kbts'
        },
        {
          name: '成交额',
          sort: 'cje'
        },
        {
          name: '成交量',
          sort: 'cjl'
        },
        {
          name: '流通市值',
          sort: 'ltsz'
        },
        {
          name: '总市值',
          sort: 'zsz'
        }
      ],
      poolArr1: [],
      // 炸板池的排序标志位及参数
      sortC2: -1,
      sortDirectionC2: ['', 'down', '', '', '', '', '', ''],
      defaultSortC2: {
        sort: 'upRise',
        lift: 1, //1降序 -1升序
        arr: 'poolArr2' //排序的数组
      },
      statSortC2: {
        flag: '',
        value: ''
      },
      sortNameC2: [{
          name: '最新价',
          sort: 'price'
        },
        {
          name: '涨跌幅',
          sort: 'upRise'
        },
        {
          name: '换手率',
          sort: 'hsl'
        },
        {
          name: '首次涨停时间',
          sort: 'scztsj'
        },
        {
          name: '成交额',
          sort: 'jye'
        },
        {
          name: '成交量',
          sort: 'jyl'
        },
        {
          name: '流通市值',
          sort: 'ltz'
        },
        {
          name: '总市值',
          sort: 'zsz'
        }
      ],
      poolArr2: [],
      // 跌停池的排序标志位及参数
      sortC3: -1,
      sortDirectionC3: ['', '', 'down', '', '', '', '', '', '', '', ''],
      defaultSortC3: {
        sort: 'hsl',
        lift: 1, //1降序 -1升序
        arr: 'poolArr3' //排序的数组
      },
      statSortC3: {
        flag: 'desc',
        value: 'huanshou'
      },
      sortNameC3: [{
          name: '最新价',
          sort: 'price'
        },
        {
          name: '涨跌幅',
          sort: 'upRise'
        },
        {
          name: '换手率',
          sort: 'hsl'
        },
        {
          name: '是否开板',
          sort: 'isopen'
        },
        {
          name: '首次跌停时间',
          sort: 'scdtsj'
        },
        {
          name: '最终跌停时间',
          sort: 'zzdtsj'
        },
        {
          name: '连板数',
          sort: 'lbzs'
        },
        {
          name: '成交额',
          sort: 'jye'
        },
        {
          name: '成交量',
          sort: 'jyl'
        },
        {
          name: '流通市值',
          sort: 'ltz'
        },
        {
          name: '总市值',
          sort: 'zsz'
        }
      ],
      poolArr3: [],
      //趋势连阳的排序标志位及参数
      sortC4: -1,
      sortDirectionC4: ['', '', 'down', '', '', '', '', '', '', '', ''],
      defaultSortC4: {
        sort: 'hsl',
        lift: 1, //1降序 -1升序
        arr: 'poolArr4' //排序的数组
      },
      statSortC4: {
        flag: '',
        value: ''
      },
      sortNameC4: [
          {
        name: '最新价',
        sort: 'price'
      },
        {
          name: '涨跌幅',
          sort: 'upRise'
        },
        {
          name: '换手率',
          sort: 'hsl'
        },
        {
          name: '所属行业',
          sort: 'industryname'
        },
        {
          name: '成交额',
          sort: 'jye'
        },
        {
          name: '成交量',
          sort: 'jyl'
        },
        {
          name: '流通市值',
          sort: 'ltz'
        },
        {
          name: '总市值',
          sort: 'zsz'
        },
      ],
      poolArr4: [],
      //创新高的排序标志位及参数
      sortC5: -1,
      sortDirectionC5: ['', '', 'down', '', '', '', '', '', '', '', ''],
      defaultSortC5: {
        sort: 'hsl',
        lift: 1, //1降序 -1升序
        arr: 'poolArr5' //排序的数组
      },
      statSortC5: {
        flag: '',
        value: ''
      },
      sortNameC5: [
        {
          name: '最新价',
          sort: 'price'
        },
        {
          name: '涨跌幅',
          sort: 'upRise'
        },
        {
          name: '换手率',
          sort: 'hsl'
        },
        {
          name: '所属行业',
          sort: 'industryname'
        },
        {
          name: '成交额',
          sort: 'jye'
        },
        {
          name: '成交量',
          sort: 'jyl'
        },
        {
          name: '流通市值',
          sort: 'ltz'
        },
        {
          name: '总市值',
          sort: 'zsz'
        },
      ],
      poolArr5: [],
      /*------涨停基因的参数--------*/
      // 涨停基因的请求参数
      geneRequestData: {
        op: 'getSelfStockList',
        orderBy: 'stockCode',
        sortType: 'asc',
        direction: 'down'
      },
      // 搜索内容
      stockSearch: '',
      // 是否是搜索页
      inSearch: false,
      // 搜索的内容
      searchArr: [],
      // 搜索的内容是否为空
      searchEmpty: false,
      // 涨停基因的title名字
      sortG1: -1,
      sortDirectionG1: ['', '', ''],
      sortNameG1: [{
          name: '涨停基因'
        },
        {
          name: '价格'
        },
        {
          name: '涨幅'
        }
      ],
      // 我的自选股
      ownStock: [],
      // 刷新的自选股数据
      refreshOwnStock: [],
      // 自选股是否为空
      ownEmpty: false,
      // 自选股是否刷新了
      ownRefresh: false,
      // 自选股起始的页码
      ownPage: 1,
      // 自选股是否到底部了
      bottomg1: true,
      // 自选股是否没有下一页了
      noMoreOwnStock: false,
      // 全市场个股
      marketStock: [],
      // 全市场个股刷新数据
      refreshMarketStock: [],
      // 全市场个股是否为空
      marketEmpty: false,
      // 全市场个股是否刷新了
      marketRefresh: false,
      // 全市场个股的起始页码
      marketPage: 1,
      // 全市场个股是否到底部了
      bottomg2: true,
      // 全市场个股是否有下一页
      noMoreMarketStock: false,
      /**涨停监控参数 */
      // 潜力连板的的请求参数
      monitorRequestData1: {
        arr: 'monitorArr1',
        tab: 'tab1',
        orderBy: 'lbzs',
        sort: -1,
        index: 0,
        label: 'lianban',
        lift: 1
      },
      // 高度活跃的请求参数
      monitorRequestData2: {
        arr: 'monitorArr2',
        tab: 'tab2',
        orderBy: 'currentIncrease',
        sort: -1,
        index: 0,
        label: 'current',
        lift: 1
      },
      // 已关注个股的请求参数
      monitorRequestData3: {
        arr: 'monitorArr3',
        tab: 'tab3',
        orderBy: 'addTime',
        sort: -1,
        index: 0,
        label: 'moren',
        lift: 1
      },
      // 订阅的请求参数
      subscription: {
        op: '',
        stockCode: ''
      },
      // 潜力连板的排序参数
      sortM1: -1,
      sortDirectionM1: ['down', '', '', '', '', ''],
      defaultSortM1: {
        sort: 'lbzs',
        lift: 1,
        arr: 'monitorArr1'
      },
      sortNameM1: [{
          name: '连板数',
          sort: 'lbzs'
        },
        {
          name: '明日涨停概率',
          sort: 'ztgl'
        },
        {
          name: '涨幅',
          sort: 'upRise'
        },
        {
          name: '涨速',
          sort: 'upRate'
        },
        {
          name: '最新价',
          sort: 'price'
        },
        {
          name: '涨停原因',
          sort: 'ztyy'
        }
      ],
      // 高度活跃的排序参数
      sortM2: -1,
      sortDirectionM2: ['down', '', '', '', '', ''],
      defaultSortM2: {
        sort: 'currentIncrease',
        lift: 1,
        arr: 'monitorArr2'
      },
      sortNameM2: [{
          name: '当前涨幅',
          sort: 'currentIncrease'
        },
        {
          name: '涨停基因',
          sort: 'limitGene'
        },
        {
          name: '近5分钟涨幅',
          sort: 'fiveMinRise'
        },
        {
          name: '卖盘力量',
          sort: 'sellPower'
        },
        {
          name: '买盘力量',
          sort: 'buyPower'
        },
        {
          name: '当日最大涨幅',
          sort: 'todayMaxRise'
        }
      ],
      // 已关注个股的排序参数
      sortM3: -1,
      sortDirectionM3: ['', ''],
      defaultSortM3: {
        sort: 'addTime',
        lift: 1,
        arr: 'monitorArr3'
      },
      sortNameM3: [{
          name: '当前涨幅',
          sort: 'change'
        },
        {
          name: '最新价',
          sort: 'price'
        }
      ],
      monitorSetting: [{
          name: '封涨停',
          value: '1',
          active: false
        },
        {
          name: '逼近涨停',
          value: '2',
          active: false
        },
        {
          name: '打开涨停',
          value: '3',
          active: false
        },
        {
          name: '即将打开涨停',
          value: '10',
          active: false
        },
        {
          name: '逼近跌停',
          value: '5',
          active: false
        },
        {
          name: '封跌停',
          value: '4',
          active: false
        },
        {
          name: '打开跌停板',
          value: '6',
          active: false
        },
        {
          name: '即将打开跌停',
          value: '11',
          active: false
        },
        {
          name: '大幅拉升',
          value: '8',
          active: false
        },
        {
          name: '快速跳水',
          value: '9',
          active: false
        }
      ],
      // 是否已经知道了有设置区域
      isFirstEnter: null,
      // setting的按钮文字
      floatButtonTxt: '确认并开启提醒',
      // 当前的setting内容
      currentSetting: [],
      // 老的setting内容
      oldStatus: [],
      // 是否已经setting了
      hasSetting: false,
      // 涨停监控的loading标志位
      monitorRefresh: false,
      // 三个数组的数据
      monitorArr1: [],
      monitorArr2: [],
      monitorArr3: [],
      // 三个数组是否为空
      monitorArr1Empty: false,
      monitorArr2Empty: false,
      monitorArr3Empty: false,
      monitorMax30: false,
      // 监控搜索输入框内容
      monitorSearchPattern: '',
      // 潜力连板个股展示条数
      potentialShowLength: 5,
      // 市场龙头展示条数
      faucetShowLength: 5,
      // 关注股票代码列表
      monitorStocksCode: []
    },
    methods: {
      // 搜索点击跳转搜索页
      handleMonitorSearchClick() {
        localStorage.setItem(UPDATE_MONITOR_LOCAL_KEY, 'true');
        const searchUrl = "client.html?action=ymtz^url=" + location.protocol + hxmConfig.monitorSearch + "^webid=2804^fontzoom=no^mode=new";
        this.registerOnShowListener();
        thsStats.jumpPageStat('index', 'monitor.search', '')
        location.href = searchUrl;
      },
      // 添加页面显示状态监听
      registerOnShowListener() {
        if (this.onShowIsRegisterd) {
          return;
        }
        this.onShowIsRegisterd = true;
        var hidden, visibilityChange;
        if (typeof document.hidden !== 'undefined') {
          hidden = 'hidden';
          visibilityChange = 'visibilitychange';
        } else if (typeof document.webkitHidden !== 'undefined') {
          hidden = 'webkitHidden';
          visibilityChange = 'webkitvisibilitychange';
        }
        if (!visibilityChange) {
          return;
        }
        document.addEventListener(visibilityChange, _ => {
          if (document[hidden]) {
            return;
          }
          const localData = localStorage.getItem(UPDATE_MONITOR_LOCAL_KEY);
          if (localData) {
            localStorage.removeItem(UPDATE_MONITOR_LOCAL_KEY);
            this.updateMonitorStocks();
          }
        });
      },
      // 搜索页返回后更新关注股票列表
      updateMonitorStocks() {
        $.ajax({
          type: "get",
          url: hxmConfig.baseApi,
          data: {
            op: 'getEstimateLimitUpStock'
          },
          success: res => {
            if (res.code === 0) {
              this.monitorArr3.splice(0, this.monitorArr3.length);
              this.monitorStocksCode.splice(0, this.monitorStocksCode.length);
              for (let i = 0; i < res.data.monitorStockList.length; i++) {
                const item = res.data.monitorStockList[i];
                item.limitRemind = true;
                this.monitorArr3.push(item);
                this.monitorStocksCode.push(item.stockCode);
                this.monitorArr3.sort(compare(this.defaultSortM3.sort, this.defaultSortM3.lift, 'stockcode'))
              }
            } else {
              this.$toast.error('已监控股票获取失败，请稍后再试');
            }
          },
          error: err => {
            console.log(err);
            this.$toast.error('已监控股票获取失败，请稍后再试');
          }
        });
      },
      closeMarquee:function(){
        this.marquee.close = true;
        clearInterval(this.marquee.timer)
      },
      // 跑马灯
      showMarquee: function () {
        var that = this;
        that.marquee.animate = true;
        setTimeout(function () {
          that.marquee.list.push(that.marquee.list[0]);
          that.marquee.list.shift();
          that.marquee.animate = false;
        }, 500);
      },
      // 昨日涨停今日行情的提示弹窗
      potentialInfo: function (from) {
        if (this.summaryTips) {
          this.summaryTips = false
        } else {
          thsStats.clickStat('index', 'outline.potential.tips')
          this.summaryTips = true
        }
      },
      // 最多30支监控弹窗
      max30alert: function (from) {
        this.monitorMax30 = false;
      },
      // 节流处理
      debounce: function (func, delay) {
        var that = this
        var timer
        return function (args) {
          if (timer) {
            clearTimeout(timer)
          }
          timer = setTimeout(function () {
            func.call(that, args)
          }, delay)
        }
      },
      // 底部的tab切换
      switchTab: function (tab, index) {
        var that = this
        this.currentTab = index
        if (index == 0) {
          that.summaryRefresh = true
          thsStats.clickStat('index', 'outline')
          this.getSummaryData().s1(function (res) {}, function (res) {})
          this.hqRefresh().potential('limitSummary')
        } else if (index == 1) {
          if (this.loading2) {
            $('#initLoading').removeClass('hide')
            this.loading2 = false
            that.getCompoundAllData().faucet()
          }
          thsStats.clickStat('index', 'replay')
        } else if (index == 2) {
          if (this.loading3) {
            $('#initLoading').removeClass('hide')
            if (this.geneTab == 0) {
              this.geneRequestData['op'] = 'getSelfStockList'
              this.getGeneData().getOwnStock(this.geneRequestData, this.ownPage)
            } else {
              this.geneRequestData['op'] = 'getStockList'
              this.getGeneData().getMarketStock(this.geneRequestData, this.marketPage)
            }
            this.loading3 = false
          } else {
            this.refresh('gene', 'tab3')
          }
          thsStats.clickStat('index', 'gene')
        } else if (index == 3) {
          if (this.loading4) {
            this.loading4 = false
            setTimeout(function () {
              that.listenTabScroll()
            }, 50)
          } else {
            this.refresh('monitor', 'tab4')
          }

          thsStats.clickStat('index', 'monitor')
        }
      },
      // 所有的跳转管理
      jump: function (txt, item, index) {
        var that = this
        var url
        if (txt == 'todayhq') {
          thsStats.jumpPageStat('index', 'outline.market.des', 'pdt_pms_269_market')
          url = hxmConfig.todayhq
        } else if (txt == 'limitSummary') {
          url = hxmConfig.limitSummary
          thsStats.jumpPageStat('index', 'outline.survey.des', 'pdt_pms_269_rise')
        } else if (txt == 'compoundDetail') {
          thsStats.jumpPageStat('index', 'replay.fupan.stock.lb' + item.lbzs + '.' + (index + 1), 'pdt_pms_269_replay', {
            targid: 'stock_' + item.stockcode,
            date_event: that.selDay
          })
          var code = item.stockcode
          var date = item.date
          var size = item.lbzs
          var marketId = item.marketcode
          var boardNum = item.lbzs
          var name = item.stockname
          url = hxmConfig.compoundDetail + '?stockcode=' + code + '&date=' + date + '&size=' + size + '&marketid=' + marketId + '&boardNum=' + boardNum + '&name=' + name
          url = encodeURI(url)
        } else if (txt == 'stockLimitDetail') {
          url = hxmConfig.stockLimitDetail
          thsStats.jumpPageStat('index', 'replay.fupan.date.rise', 'pdt_pms_269_hisrise', {
            date_event: that.selDay
          })
        } else if (txt == 'search') {
          var code = item.stockCode
          var marketId = item.marketId
          var url = hxmConfig.ztDetail + '?code=' + code + '&marketId=' + marketId
          thsStats.jumpPageStat('index', 'gene.search.res.' + (index + 1), 'pdt_pms_269_gene', {
            targid: 'stock_' + code
          })
        } else if (txt == 'ownStock') {
          var code = item.stockCode
          var marketId = item.market
          var url = hxmConfig.ztDetail + '?code=' + code + '&marketId=' + marketId
          var value
          if (that.geneRequestData.orderBy == 'stockCode') {
            value = 'code'
            thsStats.jumpPageStat('index', 'gene.my.moren.paixu.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          } else if (that.geneRequestData.orderBy == 'score') {
            value = 'jiyin'
            thsStats.jumpPageStat('index', 'gene.my.' + value + '.' + that.geneRequestData.sortType + '.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          } else if (that.geneRequestData.orderBy == 'price') {
            value = 'jiage'
            thsStats.jumpPageStat('index', 'gene.my.' + value + '.' + that.geneRequestData.sortType + '.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          } else if (that.geneRequestData.orderBy == 'change') {
            value = 'zhangfu'
            thsStats.jumpPageStat('index', 'gene.my.' + value + '.' + that.geneRequestData.sortType + '.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          }
        } else if (txt == 'indexOwnStock') {
          var code = item.stockCode
          var marketId = item.market
          var url = hxmConfig.ztDetail + '?code=' + code + '&marketId=' + marketId
          thsStats.jumpPageStat('index', 'outline.my.' + (index + 1), 'pdt_pms_269_gene', {
            targid: 'stock_' + code
          })
        } else if (txt == 'marketStock') {
          var code = item.stockCode
          var marketId = item.market
          var url = hxmConfig.ztDetail + '?code=' + code + '&marketId=' + marketId
          var value
          if (that.geneRequestData.orderBy == 'stockCode') {
            value = 'code'
            thsStats.jumpPageStat('index', 'gene.all.moren.paixu.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          } else if (that.geneRequestData.orderBy == 'score') {
            value = 'jiyin'
            thsStats.jumpPageStat('index', 'gene.all.' + value + '.' + that.geneRequestData.sortType + '.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          } else if (that.geneRequestData.orderBy == 'price') {
            value = 'jiage'
            thsStats.jumpPageStat('index', 'gene.all.' + value + '.' + that.geneRequestData.sortType + '.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          } else if (that.geneRequestData.orderBy == 'change') {
            value = 'zhangfu'
            thsStats.jumpPageStat('index', 'gene.all.' + value + '.' + that.geneRequestData.sortType + '.' + (index + 1), 'pdt_pms_269_gene', {
              targid: 'stock_' + code
            })
          }
        }
        var _url = 'client.html?action=ymtz^url=https:' + url + '^webid=2804^mode=new'
        setTimeout(function () {
          location.href = _url
        }, 20)
      },
      // 跳转分时
      jumpFenshi: function (txt, item, index) {
        var that = this
        var code, marketid
        if (txt == 'potentialStock') {
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'outline.potential.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'marketLeader') {
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'outline.leader.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'conceptualTop3') {
          code = item.stockCode
          marketid = item.market
          thsStats.jumpNativeStat('index', 'outline.concept.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'allLimit') {
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'replay.longtou.stock.' + (index + 1), '2205', {
            targid: 'stock_' + code,
            date_event: that.selDay2
          })
        } else if (txt == 'poolArr1') {
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'replay.new.' + that.statSortC1.value + '.' + that.statSortC1.flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'poolArr2') {
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'replay.rise.' + that.statSortC2.value + '.' + that.statSortC2.flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'poolArr3') {
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'replay.fall.' + that.statSortC3.value + '.' + that.statSortC3.flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        }else if(txt == 'poolArr4'){
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'replay.[todo].' + that.statSortC4.value + '.' + that.statSortC4.flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        }else if(txt == 'poolArr5'){
          code = item.stockcode
          marketid = item.marketcode
          thsStats.jumpNativeStat('index', 'replay.[todo].' + that.statSortC4.value + '.' + that.statSortC4.flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'limitMonitor2') {
          code = item.stockCode
          marketid = item.market
          var flag
          that.monitorRequestData2.lift == 1 ? (flag = 'desc') : (flag = 'asc')
          thsStats.jumpNativeStat('index', 'monitor.active.' + that.monitorRequestData2.label + '.' + flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'limitMonitor1') {
          code = item.stockcode
          marketid = item.marketcode
          var flag
          that.monitorRequestData1.lift == 1 ? (flag = 'desc') : (flag = 'asc')
          thsStats.jumpNativeStat('index', 'monitor.latent.' + that.monitorRequestData1.label + '.' + flag + '.' + (index + 1), '2205', {
            targid: 'stock_' + code
          })
        } else if (txt == 'limitMonitor3') {
          code = item.stockCode
          marketid = item.market
          var flag
          that.monitorRequestData3.lift == 1 ? (flag = 'desc') : (flag = 'asc')
          if (that.monitorRequestData3.label == 'moren') {
            thsStats.jumpNativeStat('index', 'monitor.follow.' + that.monitorRequestData3.label + '.' + 'paixu' + '.' + (index + 1), '2205', {
              targid: 'stock_' + code
            })
          } else {
            thsStats.jumpNativeStat('index', 'monitor.follow.' + that.monitorRequestData3.label + '.' + flag + '.' + (index + 1), '2205', {
              targid: 'stock_' + code
            })
          }
        }
        var url = 'client.html?action=ymtz^stockcode=' + code + '^marketid=' + marketid + '^webid=2205'
        setTimeout(function () {
          location.href = url
        }, 20)
      },
      // 首页的查看更多
      findMore: function (txt) {
        function lineAnimate(obj, stance) {
          obj.style.webkitTransform = 'translate3d(' + stance + 'px,0,0)'
          obj.style.transform = 'translate3d(' + stance + 'px,0,0)'
          obj.style.webkitTransition = 'all 0.1s ease-in-out'
          obj.style.transition = 'all 0.1s ease-in-out'
        }
        if (txt == 'compound0') {
          // 潜力连板个股
          if (this.potentialShowLength < this.indexSummaryData.potential.arr.length) {
            // 查看更多新增显示 10 条
            this.potentialShowLength += 10;
          } else {
            // 收起时展示前 5 条
            this.potentialShowLength = 5;
          }
          thsStats.clickStat('index', 'outline.potential.more')
        } else if (txt == 'compound1') {
          // 市场龙头
          if (this.faucetShowLength < this.indexSummaryData.faucet.arr.length) {
            // 查看更多新增显示 10 条
            this.faucetShowLength += 10;
          } else {
            // 收起时展示前 5 条
            this.faucetShowLength = 5;
          }
          thsStats.clickStat('index', 'outline.leader.more')
        } else if (txt == 'geneOwn') {
          $(window).scrollTop(0)
          this.currentTab = 2
          this.geneTab = 0
          $('.limitGene .activeBorder div')[0].className = 'line left'
          if (this.loading3) {
            $('#initLoading').removeClass('hide')
            if (this.geneTab == 0) {
              this.geneRequestData['op'] = 'getSelfStockList'
              this.getGeneData().getOwnStock(this.geneRequestData, this.ownPage)
            } else {
              this.geneRequestData['op'] = 'getStockList'
              this.getGeneData().getMarketStock(this.geneRequestData, this.marketPage)
            }
            this.loading3 = false
          }
          thsStats.clickStat('index', 'outline.my.more')
        }
      },
      // 所有tab切换（除了底部的tab切换）
      initTab: function () {
        var that = this
        var windowWidth = $(window).width()
        // 涨停复盘的tab切换初始化
        var cTabClick = $('.limitCompound .compoundTag')
        var cTabLi = cTabClick.find('li')
        var cLineDiv = $('.limitCompound .activeBorder .line')
        // 涨停基因的tab切换初始化
        var gTabClick = $('.limitGene .geneSelStockTab')
        var gTabLi = gTabClick.find('li')
        var gLineDiv = $('.limitGene .activeBorder .line')
        // 涨停监控的tab切换初始化
        var mTabClick = $('.limitMonitor .monitorTag')
        var mTabLi = mTabClick.find('li')
        var mLineDiv = $('.limitMonitor .activeBorder .line')
        // 涨停复盘的tab切换点击事件监听
        for (var i = 0; i < cTabLi.length; i++) {
          cTabLi[i].start = i
          cTabLi[i].onclick = function () {
            var star = this.start
            that.currentTag = star
            for (var i = 0; i < cTabLi.length; i++) {
              cTabLi[i].className = ''
            }
            cTabLi[star].className = 'active'

            // init.lineAnme(cLineDiv[0], (windowWidth / cTabLi.length) * star)
            init.lineAnme(cLineDiv[0], 1.5 * star,"ztfp")
            cLineDiv.data('stance', (windowWidth / cTabLi.length) * star)
          }
        }
        // 涨停基因tab切换点击事件监听
        for (var i = 0; i < gTabLi.length; i++) {
          gTabLi[i].start = i
          gTabLi[i].onclick = function () {
            var star = this.start
            that.geneTab = star
            for (var i = 0; i < gTabLi.length; i++) {
              gTabLi[i].className = ''
            }
            gTabLi[star].className = 'active'
            star == 0 && ($('.limitGene .activeBorder .line').removeClass('right') && $('.limitGene .activeBorder .line').addClass('left'))
            star == 1 && ($('.limitGene .activeBorder .line').removeClass('left') && $('.limitGene .activeBorder .line').addClass('right'))
          }
        }
        // 涨停监控的tab切换点击事件监听
        for (var i = 0; i < mTabLi.length; i++) {
          mTabLi[i].start = i
          mTabLi[i].onclick = function () {
            var star = this.start
            that.monitorTab = star
            for (var i = 0; i < mTabLi.length; i++) {
              mTabLi[i].className = ''
            }
            mTabLi[star].className = 'active'
            setTimeout(function () {
              var mTabLiWidth = mTabLi.eq(0).width()
              init.lineAnme(mLineDiv[0], mTabLiWidth * star)
              mLineDiv.data('stance', mTabLiWidth * star)
            }, 50)
          }
        }
        var init = {
          lineAnme: function (obj, stance, tag) {
            if(tag == 'ztfp'){
              obj.style.webkitTransform = 'translate3d(' + stance + 'rem,0,0)'
              obj.style.transform = 'translate3d(' + stance + 'rem,0,0)'
            }else{
              obj.style.webkitTransform = 'translate3d(' + stance + 'px,0,0)'
              obj.style.transform = 'translate3d(' + stance + 'px,0,0)'
            }

            obj.style.webkitTransition = 'all 0.1s ease-in-out'
            obj.style.transition = 'all 0.1s ease-in-out'
          }
        }
      },
      /**
       * 显示和隐藏事件监听
       */
      showHide() {
        var that = this;
        window.registerWebListener('onShow', () => {
          if (!that.wencaiTimer && that.askTextList.length > 1) {
            that.startWenCaiAsk(that.askTextList.length);
          }
        });
        window.registerWebListener('onHide', () => {
          if (that.wencaiTimer) {
            window.clearInterval(that.wencaiTimer);
            that.wencaiTimer = null;
          }
        });
      },
      /**
       * 判断用户是否购买了涨停助手（赠送的不算购买，是不显示问财机器人的）
       */
      getUserZtzsPermission() {
        var that = this;
        $.ajax({
          type: "POST",
          url: hxmConfig.userAuthenticateApi,
          headers:{"Content-Type":"application/json;charset=UTF-8"},
          dataType:'json',
          data: JSON.stringify({'auth_code': ['ztjyzs'], 'app_name': "mobileweb-vaserviece-limitup-front-pod"}),
          timeout: 10000,
          xhrFields: {withCredentials: true},
          success: function (res) {
            if (res && res.data && res.data['ztjyzs']) {
              // 初始化问财问句
              that.initWencai();
            }
          },
          error: function (error) {
            window.ClientMonitor.reportFrameErrors(
              {
                category: 'ajax', // 类型
                grade: 'Error', // 级别
              },
              error
            );
          }}
        );
      },
      /**
       * 获取问财机器人灰度名单和白名单
       */
      getWencaiConfig: function () {
        var that = this;
        var userid = window.getUserid() + '';
        var useridSuffix = userid.charAt(userid.length - 1);
        ajax(hxmConfig.wencaiSwitchApi, {}, function (res) {
            if (res && res['status_code'] === 0 && res['data']) {
              var userConfInfo = res['data']['limitUpWenCai'];
              var gayUser = userConfInfo['grayUser'].split(',');
              var whiteUser = userConfInfo['whiteUser'].split(',');
              for (var j = 0; j < whiteUser.length; j++) {
                if (userid === whiteUser[j]) {
                  // 如果是白名单用户，直接初始化问财机器人
                  that.initWencai();
                  return;
                }
              }
              for (var i = 0; i < gayUser.length; i++) {
                if (useridSuffix === gayUser[i]) {
                  // 如果是灰名单用户，则看是否为购买或赠送
                  that.getUserZtzsPermission();
                }
              }
            } else {
              that.showWencai = false;
            }
        }, function () {
          that.showWencai = false;
        }, 'get', true);
      },
      /**
       * 初始化问财机器人
       */
      initWencai: function () {
        var that = this;
        that.showWencai = true;
        ajax(hxmConfig.wencaiAskTextApi, {}, function (res) {
            if (res && Array.isArray(res.data) && res.data.length > 0) {
              that.askTextList = res.data;
              that.startWenCaiAsk(res.data.length);
            } else {
              that.handlerAskEmpty();
            }
        }, function () {
          that.handlerAskEmpty();
        }, 'get', true);
      },
      /**
       * 开启问财问句循环滚动
       */
      startWenCaiAsk: function (len) {
        var that = this;
        // 2个及以上问句的时候才滚动
        if (len > 1) {
          that.askTextShowIndex = that.askTextShowIndex || 0;
          var height = document.querySelector('.iwencai_input_box').getBoundingClientRect().height;
          // 循环滚动
          that.wencaiTimer = setInterval(() => {
            that.askTextShowIndex ++;
              var yDistance = (that.askTextShowIndex % len) * -height;
              if (yDistance === 0) {
                  document.querySelector('.ask-list').style.transition = 'all 0s';
              } else {
                  document.querySelector('.ask-list').style.transition = 'all 1s';
              }
              document.querySelector('.ask-list').style.transform = `translateY(${yDistance}px)`;
          }, 10000);
        }
      },
      /**
       * 问财问句为空时 循环判断潜力连板个股是否有数据
       */
      handlerAskEmpty: function () {
        var that = this;
        that.qlgTimer = setInterval(() => {
          if (that.qlgStockNameList.length > 0) {
            clearInterval(that.qlgTimer);
            that.qlgTimer = null;
            // 生成潜力股问财语句列表
            var askTxtList = [];
            for (var i = 0; i < that.qlgStockNameList.length; i++) {
              var txt =  '分析一下' + that.qlgStockNameList[i] + '涨停概率';
              askTxtList.push(txt);
            }
            that.askTextList = askTxtList;
            that.startWenCaiAsk(askTxtList.length);
          } else {
            // 当潜力连板个股为空时的兜底问句
            that.askTextList = ['涨停基因超过50分以上的股票'];
          }
        }, 200);
      },
      /**
       * 点击问财机器人
       */
      askWencai: function () {
        window.hxmClickStat('pdt_pms_269.shouyeaime');
        // android半屏有问题 先ios半屏: 2724，android全屏: 2719，都使用client协议
        var webid = window.getPlatform() === 'iphone' ? '2724' : '2719';
        var wencaiUrl = 'client://client.html?action=ymtz^webid=' + webid + '^comefrom=ShouchaoLimitUp^query=';
        var query = '';
        if (this.askTextList.length > 0) {
          var idx = this.askTextShowIndex % this.askTextList.length;
          query = this.askTextList[idx] || '';
        } else {
          query = '涨停基因超过50分以上的股票';
        }
        location.href = wencaiUrl + query;
      },
      // 所有的tab切换的点击事件（除了底部的tab切换）
      cutover: function (from) {
        var that = this
        $(window).scrollTop(0)
        if (from == 'g1') {
          that.geneRequestData['op'] = 'getSelfStockList'
          that.ownPage = 1
          that.getGeneData().getOwnStock(that.geneRequestData, that.ownPage)
          thsStats.clickStat('index', 'gene.my')
        } else if (from == 'g2') {
          that.geneRequestData['op'] = 'getStockList'
          that.marketPage = 1
          that.getGeneData().getMarketStock(that.geneRequestData, that.marketPage)
          thsStats.clickStat('index', 'gene.all')
        } else if (from == 'c3') {
          if (that.pool1Flag) {
            that.getCompoundAllData().pool1()
            that.pool1Flag = false
          }
          thsStats.clickStat('index', 'replay.new')
        } else if (from == 'c4') {
          if (that.pool2Flag) {
            that.getCompoundAllData().pool2()
            that.pool2Flag = false
          }
          thsStats.clickStat('index', 'replay.rise')
        } else if (from == 'c5') {
          if (that.pool3Flag) {
            that.getCompoundAllData().pool3()
            that.pool3Flag = false
          }
          thsStats.clickStat('index', 'replay.fall')
        }else if(from == 'c6'){
          if (that.pool4Flag) {
            that.getCompoundAllData().pool4()
            that.pool4Flag = false
          }
          thsStats.clickStat('index', 'replay.qushi.click')
        }else if(from == 'c7'){
          if (that.pool5Flag) {
            that.getCompoundAllData().pool5()
            that.pool5Flag = false
          }
          thsStats.clickStat('index', 'replay.xingao.click')
        } else if (from == 'c2') {
          if (this.loading2) {
            $('#initLoading').removeClass('hide')
            this.loading2 = false
            that.getCompoundAllData().faucet()
          }
          thsStats.clickStat('index', 'replay.longtou')
        } else if (from == 'c1') {
          if (this.loading2) {
            this.loading2 = false
            that.getCompoundAllData().faucet()
          }
          thsStats.clickStat('index', 'replay.fupan')
        } else if (from == 'm1') {
          thsStats.clickStat('index', 'monitor.zhangting')
        } else if (from == 'm2') {
          thsStats.clickStat('index', 'monitor.active')
        } else if (from == 'm3') {
          thsStats.clickStat('index', 'monitor.follow')
          if (this.needUpdateMonitorStocks) {
            this.updateMonitorStocks();
            this.needUpdateMonitorStocks = false;
          }
        }
      },
      // 日历的初始化
      initCalendar: function () {
        var that = this

        function c1(date) {
          $('#calendar').calendar({
            showGotoDetail: true,
            number: 1,
            date: date,
            backToday: function () {
              var day = that.lastDay.split('-').join('')
              that.compoundObject1['current'] = that.compoundObject1['detail'][day]
              that.selDay = that.lastDay
              that.compoundObject1.advanceData = false
              that.compoundObject1.emptyData = false
              thsStats.clickStat('index', 'replay.fupan.date.new', {
                date_event: that.selDay
              })
            },
            moveRight: function () {},
            moveLeft: function () {},
            clickWeekDay: function ($ele) {
              var day = $ele.data('date').split('-')
              var day2 = date.split('-')
              if (that.compoundObject1['detail'][day.join('')]) {
                that.compoundObject1['current'] = that.compoundObject1['detail'][day.join('')]
                that.compoundObject1.advanceData = false
                that.compoundObject1.emptyData = false
              } else {
                that.compoundObject1['current'] = []
                if (+new Date(day[0], day[1] - 1, day[2]) > +new Date(day2[0], day2[1] - 1, day2[2])) {
                  that.compoundObject1.advanceData = true
                  that.compoundObject1.emptyData = false
                } else {
                  that.compoundObject1.advanceData = false
                  that.compoundObject1.emptyData = true
                }
              }
              that.selDay = $ele.data('date')
              thsStats.clickStat('index', 'replay.fupan.date.click', {
                date_event: that.selDay
              })
            },
            clickListDay: function ($ele) {
              var day = $ele.data('date').split('-')
              var day2 = date.split('-')
              if (that.compoundObject1['detail'][day.join('')]) {
                that.compoundObject1['current'] = that.compoundObject1['detail'][day.join('')]
                that.compoundObject1.advanceData = false
                that.compoundObject1.emptyData = false
              } else {
                that.compoundObject1['current'] = []
                if (+new Date(day[0], day[1] - 1, day[2]) > +new Date(day2[0], day2[1] - 1, day2[2])) {
                  that.compoundObject1.advanceData = true
                  that.compoundObject1.emptyData = false
                } else {
                  that.compoundObject1.advanceData = false
                  that.compoundObject1.emptyData = true
                }
              }
              that.selDay = $ele.data('date')
              thsStats.clickStat('index', 'replay.fupan.date.click', {
                date_event: that.selDay
              })
            },
            clickDetail: function () {
              that.jump('stockLimitDetail')
            },
            clickFold: function () {}
          })
        }

        function c2(date) {
          $('#calendar2').calendar({
            showGotoDetail: false,
            number: 2,
            date: date,
            backToday: function () {
              var day = that.lastDay2.split('-').join('')
              that.faucetObject['current'] = that.faucetObject['detail'][day]
              that.selDay2 = that.lastDay2
              that.faucetObject.advanceData = false
              that.faucetObject.emptyData = false
              thsStats.clickStat('index', 'replay.longtou.date.new', {
                date_event: that.selDay2
              })
            },
            moveRight: function () {},
            moveLeft: function () {},
            clickWeekDay: function ($ele) {
              var day = $ele.data('date').split('-')
              var day2 = date.split('-')
              if (that.faucetObject['detail'][day.join('')]) {
                that.faucetObject['current'] = that.faucetObject['detail'][day.join('')]
                that.faucetObject.advanceData = false
                that.faucetObject.emptyData = false
              } else {
                that.faucetObject['current'] = []
                if (+new Date(day[0], day[1] - 1, day[2]) > +new Date(day2[0], day2[1] - 1, day2[2])) {
                  that.faucetObject.advanceData = true
                  that.faucetObject.emptyData = false
                } else {
                  that.faucetObject.advanceData = false
                  that.faucetObject.emptyData = true
                }
              }
              that.selDay2 = $ele.data('date')
              thsStats.clickStat('index', 'replay.longtou.date.click', {
                date_event: that.selDay2
              })
            },
            clickListDay: function ($ele) {
              var day = $ele.data('date').split('-')
              var day2 = date.split('-')
              if (that.faucetObject['detail'][day.join('')]) {
                that.faucetObject['current'] = that.faucetObject['detail'][day.join('')]
                that.faucetObject.advanceData = false
                that.faucetObject.emptyData = false
              } else {
                that.faucetObject['current'] = []
                if (+new Date(day[0], day[1] - 1, day[2]) > +new Date(day2[0], day2[1] - 1, day2[2])) {
                  that.faucetObject.advanceData = true
                  that.faucetObject.emptyData = false
                } else {
                  that.faucetObject.advanceData = false
                  that.faucetObject.emptyData = true
                }
              }
              that.selDay2 = $ele.data('date')
              thsStats.clickStat('index', 'replay.longtou.date.click', {
                date_event: that.selDay2
              })
            },
            clickFold: function () {}
          })
        }
        return {
          c1: c1,
          c2: c2
        }
      },
      /*------所有的接口请求开始----------------------------------------------------------------------------------------------*/
      // 请求首页的接口
      getSummaryData: function () {
        var that = this
        // 首页接口1：获取自选股，头部信息
        function s1(cbok, cberr) {
          ajax(
            hxmConfig.baseApi, {
              op: 'getLimitUpSummary'
            },
            function (res) {
              if (res.code == 0) {
                clearInterval(that.marquee.timer)
                var android = getAppVersion() && getPlatform()=='gphone' && parseInt(getAppVersion().split(".").join(""))<96900;
                var ios = getAppVersion() && getPlatform()=='iphone' && parseInt(getAppVersion().split(".").join(""))<102060;
                that.indexSummaryData.isUpdating = res.data.isUpdating || false;
                if(that.indexSummaryData.isUpdating){
                  // 如果在集合竞价期间，并且是低版本机子
                  that.marquee.list[0] = "提示：集合竞价期间，数据正在获取中，即将更新"
                  if(android || ios){
                    that.marquee.list[1] = "提示：若数据显示异常，请更新同花顺至最新版本" 
                  }
                }else{
                  // 不在集合竞价期间，是低版本机子
                  if(android || ios){
                    // 这样做的目的是为了，防止第一次进页面是集合竞价，并且是低版本机子，数组长度是2,
                    // 刷新了，不是集合竞价，清空数组，然后push1个，这样既可以保证数据的动态刷新，然后还不用splice数组
                    that.marquee.list = [];
                    that.marquee.list.push("提示：若数据显示异常，请更新同花顺至最新版本") 
                  }
                }
                // 判断数组长度，大于1，才开定时器
                if (that.marquee.list.length > 1) {
                  that.marquee.timer = setInterval(that.showMarquee, 2500)
                }
                that.indexSummaryData.ownStock = res.data.limitList || []
                that.indexSummaryData.top3 = res.data.limitBoardArea || []
                if (that.indexSummaryData.top3.length == 0) {
                  that.indexSummaryData.top3Empty = true
                }
                if (that.indexSummaryData.ownStock.length == 0) {
                  that.indexSummaryData.ownStockEmpty = true
                }
                if (res.data.outLine.todayPlate && res.data.outLine.todayPlate.slowLimit != null && res.data.outLine.todayPlate.wordBoard != null && res.data.outLine.todayPlate.todayPercent != null) {
                  that.indexSummaryData.headerState['all'] = res.data.outLine.todayPlate.slowLimit + res.data.outLine.todayPlate.wordBoard
                  that.indexSummaryData.headerState['percent'] = res.data.outLine.todayPlate.todayPercent + '%'
                } else {
                  that.indexSummaryData.headerState['all'] = '--'
                  that.indexSummaryData.headerState['percent'] = '--'
                }
                $('#initLoading').addClass('hide')
                that.summaryRefresh = false
                localStorage.setItem('__LIMITHEADERSTATE__', JSON.stringify(that.indexSummaryData.headerState))
                cbok(res)
              } else {
                if(getParam('from')==='fenshi'){
                  //入口是分时页面的涨停基因
                  location.replace(hxmConfig.buyIndexNew)
                }else{
                  location.replace(hxmConfig.buyIndex)
                }
              }
            },
            function (err) {
              cberr(err)
              that.summaryRefresh = false
              $('#initLoading').addClass('hide')
              $('#errLoading').removeClass('hide')
            }
          )
        }
        // 首页接口2：获取涨停复盘
        function s2(cbok, cberr) {
          ajax(
            hxmConfig.allSummaryApi, {},
            function (res) {
              if (res.errorcode == 0) {
                $('#initLoading').addClass('hide')
                that.allCompoundArr = res.result
                that.calculateCompoundData(cbok)
              } else {
                cbok();
              }
            },
            function (err) {
              cberr();
            }
          )
        }
        // 首页接口3：获取评分信息
        function s3(res) {
          if (res.data.yesterdayLimit) {
            that.indexSummaryData.score['continue'] = res.data.yesterdayLimit.limitUp;
            that.indexSummaryData.score['up'] = res.data.yesterdayLimit.upRise;
            that.indexSummaryData.score['value'] = res.data.yesterdayLimit.endGrade;// 次日赚钱效应
            const yesterday_up_slowLimit = res.data.outLine.yesterdayPlate.slowLimit;
            const yesterday_up_wordBoard = res.data.outLine.yesterdayPlate.wordBoard;
            that.indexSummaryData.score['y'] = yesterday_up_slowLimit + yesterday_up_wordBoard;
            that.indexSummaryData.score['zf'] = res.data.yesterdayLimit.averageLimit || '--';
            $('#vuewrap').append('<div id="canvas"></div>');
            // 画跑分
            let score = that.indexSummaryData.score['value'];
            const mixScore = 0.1; //最小展示分数，这里是为了保证score大于零
            if (+score === 0) {
              score += mixScore;
            }
            that.initMeter(score);

            that.hasCanvas = true;
            localStorage.setItem(
              'LIMITUP__LIMITSCORE__',
              JSON.stringify(that.indexSummaryData.score)
            );
          }
        }
        // 首页接口4：获取潜力连板个股数据
        function s4() {
          ajax(
            hxmConfig.potentialApi, {},
            function (res) {
              if (res.errorcode == 0) {
                // 问财兜底股票名称列表
                if (Array.isArray(res.result) && res.result.length > 0) {
                  that.qlgStockNameList = res.result.map(item => item.stockname);
                }
                that.calculatePotentialData(res.result)
                setTimeout(function () {
                  that.listenTabScroll()
                }, 50)
              }
            },
            function (err) {}
          )
        }
        return {
          s1: s1,
          s2: s2,
          s3: s3,
          s4: s4
        }
      },
      // 涨停复盘的接口
      getCompoundAllData: function () {
        var that = this
        // 接口1：获取概念龙头
        function faucet() {
          ajax(
            hxmConfig.allFaucetApi, {},
            function (res) {
              that.loading2 = true
              if (res.errorcode == 0) {
                $('#initLoading').addClass('hide')
                that.allFaucetArr = res.result
                var lastkey = ''
                for (var key in that.allFaucetArr) {
                  lastkey = key
                }
                that.lastDay2 = Jen.transNumToDate(lastkey)
                that.selDay2 = that.lastDay2
                that.faucetObject['detail'] = that.allFaucetArr
                that.faucetObject['current'] = that.allFaucetArr[lastkey]
              }
              $('#calendar2').empty()
              that.initCalendar().c2(that.lastDay2)
            },
            function (err) {
              that.loading2 = true
              $('#initLoading').addClass('hide')
              $('#errLoading').removeClass('hide')
            }
          )
        }
        // 接口2：获取新股池
        function pool1() {
          ajax(
            hxmConfig.newPoolApi, {},
            function (res) {
              that.pool1Flag = true
              if (res.errorcode == 0) {
                that[that.defaultSortC1.arr] = res.result
                var tempArr = that[that.defaultSortC1.arr]
                var stockcode = []
                var marketcode = []
                if (tempArr.length != 0) {
                  for (var i = 0; i < tempArr.length; i++) {
                    stockcode.push(tempArr[i].stockcode)
                    marketcode.push(tempArr[i].marketcode)
                    tempArr[i]['price'] = '--'
                    tempArr[i]['upRise'] = '--'
                  }
                  __getMarketInfo(['10', '34818', '48'], stockcode, marketcode, function (data) {
                    var upRise = data['34818']
                    var price = data['10']
                    for (var a = 0; a < that[that.defaultSortC1.arr].length; a++) {
                      that[that.defaultSortC1.arr][a]['upRise'] = upRise[a] == '--' ? upRise[a] : parseFloat(upRise[a].split('%')[0])
                      that[that.defaultSortC1.arr][a]['price'] = price[a] == '--' ? upRise[a] : parseFloat(price[a])
                      Vue.set(that[that.defaultSortC1.arr], a, that[that.defaultSortC1.arr][a])
                    }
                    that[that.defaultSortC1.arr].length != 0 && that[that.defaultSortC1.arr].sort(compare(that.defaultSortC1.sort, that.defaultSortC1.lift, 'stockcode'))
                  })
                }
                that.statSortC1['flag'] = 'desc'
                that.statSortC1['value'] = 'huanshou'
                that.pool1Loading = false
                if (res.result.length == 0) {
                  that.pool1Empty = true
                }
                setTimeout(function () {
                  that.listenTabScroll()
                }, 50)
              }
            },
            function (err) {
              that.pool1Flag = true
              that.pool1Loading = false
            }
          )
        }
        // 接口3：获取炸版池
        function pool2() {
          ajax(
            hxmConfig.fryPoolApi, {},
            function (res) {
              that.pool2Flag = true
              if (res.errorcode == 0) {
                that[that.defaultSortC2.arr] = res.result
                var tempArr = that[that.defaultSortC2.arr]
                var stockcode = []
                var marketcode = []
                if (tempArr.length != 0) {
                  for (var i = 0; i < tempArr.length; i++) {
                    stockcode.push(tempArr[i].stockcode)
                    marketcode.push(tempArr[i].marketcode)
                    tempArr[i]['price'] = '--'
                    tempArr[i]['upRise'] = '--'
                  }
                  __getMarketInfo(['10', '34818', '48'], stockcode, marketcode, function (data) {
                    var upRise = data['34818']
                    var price = data['10']
                    for (var a = 0; a < that[that.defaultSortC2.arr].length; a++) {
                      that[that.defaultSortC2.arr][a]['upRise'] = upRise[a] == '--' ? upRise[a] : parseFloat(upRise[a].split('%')[0])
                      that[that.defaultSortC2.arr][a]['price'] = price[a] == '--' ? upRise[a] : parseFloat(price[a])
                      Vue.set(that[that.defaultSortC2.arr], a, that[that.defaultSortC2.arr][a])
                    }
                    that[that.defaultSortC2.arr].length != 0 && that[that.defaultSortC2.arr].sort(compare(that.defaultSortC2.sort, that.defaultSortC2.lift, 'stockcode'))
                  })
                }
                that.statSortC2['flag'] = 'desc'
                that.statSortC2['value'] = 'zhangdie'
                if (res.result.length == 0) {
                  that.pool2Empty = true
                }
                setTimeout(function () {
                  that.listenTabScroll()
                }, 50)
                that.pool2Loading = false
              }
            },
            function (err) {
              that.pool2Flag = true
              that.pool2Loading = false
            }
          )
        }
        // 接口4：获取跌停池
        function pool3() {
          ajax(
            hxmConfig.fallPoolApi, {},
            function (res) {
              that.pool3Flag = true
              if (res.errorcode == 0) {
                that[that.defaultSortC3.arr] = res.result
                var tempArr = that[that.defaultSortC3.arr]
                var stockcode = []
                var marketcode = []
                if (tempArr.length != 0) {
                  for (var i = 0; i < tempArr.length; i++) {
                    stockcode.push(tempArr[i].stockcode)
                    marketcode.push(tempArr[i].marketcode)
                    tempArr[i]['price'] = '--'
                    tempArr[i]['upRise'] = '--'
                  }
                  __getMarketInfo(['10', '34818', '48'], stockcode, marketcode, function (data) {
                    var upRise = data['34818']
                    var price = data['10']
                    for (var a = 0; a < that[that.defaultSortC3.arr].length; a++) {
                      that[that.defaultSortC3.arr][a]['upRise'] = upRise[a] == '--' ? upRise[a] : parseFloat(upRise[a].split('%')[0])
                      that[that.defaultSortC3.arr][a]['price'] = price[a] == '--' ? upRise[a] : parseFloat(price[a])
                      Vue.set(that[that.defaultSortC3.arr], a, that[that.defaultSortC3.arr][a])
                    }
                    that[that.defaultSortC3.arr].length != 0 && that[that.defaultSortC3.arr].sort(compare(that.defaultSortC3.sort, that.defaultSortC3.lift, 'stockcode'))
                  })
                }
                that.statSortC3['flag'] = 'desc'
                that.statSortC3['value'] = 'huanshou'
                if (res.result.length == 0) {
                  that.pool3Empty = true
                }
                setTimeout(function () {
                  that.listenTabScroll()
                }, 50)
                that.pool3Loading = false
              }
            },
            function (err) {
              that.pool3Flag = true
              that.pool3Loading = false
            }
          )
        }
        // 接口5：获取趋势连阳
        function pool4() {
          ajax(hxmConfig.trendPoolApi, {},
              function (res) {
                that.pool4Flag = true
              if (res.errorcode == 0) {
                    that[that.defaultSortC4.arr] = res.result
                    var tempArr = that[that.defaultSortC4.arr]
                    var stockcode = []
                    var marketcode = []
                    if (tempArr.length != 0) {
                      for (var i = 0; i < tempArr.length; i++) {
                        stockcode.push(tempArr[i].stockcode)
                        marketcode.push(tempArr[i].marketcode)
                        tempArr[i]['price'] = '--'
                        tempArr[i]['upRise'] = '--'
                      }
                      __getMarketInfo(['10', '34818', '48'], stockcode, marketcode, function (data) {
                        var upRise = data['34818']
                        var price = data['10']
                        for (var a = 0; a < that[that.defaultSortC4.arr].length; a++) {
                          that[that.defaultSortC4.arr][a]['upRise'] = upRise[a] == '--' ? upRise[a] : parseFloat(upRise[a].split('%')[0])
                          that[that.defaultSortC4.arr][a]['price'] = price[a] == '--' ? price[a] : parseFloat(price[a])
                          Vue.set(that[that.defaultSortC4.arr], a, that[that.defaultSortC4.arr][a])
                        }
                        that[that.defaultSortC4.arr].length != 0 && that[that.defaultSortC4.arr].sort(compare(that.defaultSortC4.sort, that.defaultSortC4.lift, 'stockcode'))
                      })
                    }
                    that.statSortC3['flag'] = 'desc'
                    that.statSortC3['value'] = 'huanshou'
                    if (res.result.length == 0) {
                      that.pool4Empty = true
                    }
                    setTimeout(function () {
                      that.listenTabScroll()
                    }, 50)
                    that.pool4Loading = false
                  }
              },
              function (err) {
                that.pool4Flag = true
                that.pool4Loading = false
              },null,true
          )
        }
        // 接口6：获取创新高
        function pool5() {
          ajax(
              hxmConfig.highPoolApi, {},
              function (res) {
              if (res.errorcode == 0) {
                that.pool5Flag = true
                that[that.defaultSortC5.arr] = res.result
                var tempArr = that[that.defaultSortC5.arr]
                var stockcode = []
                var marketcode = []
                if (tempArr.length != 0) {
                  for (var i = 0; i < tempArr.length; i++) {
                    stockcode.push(tempArr[i].stockcode)
                    marketcode.push(tempArr[i].marketcode)
                    tempArr[i]['price'] = '--'
                    tempArr[i]['upRise'] = '--'
                  }
                  __getMarketInfo(['10', '34818', '48'], stockcode, marketcode, function (data) {
                    var upRise = data['34818']
                    var price = data['10']
                    for (var a = 0; a < that[that.defaultSortC5.arr].length; a++) {
                      that[that.defaultSortC5.arr][a]['upRise'] = upRise[a] == '--' ? upRise[a] : parseFloat(upRise[a].split('%')[0])
                      that[that.defaultSortC5.arr][a]['price'] = price[a] == '--' ? upRise[a] : parseFloat(price[a])
                      Vue.set(that[that.defaultSortC5.arr], a, that[that.defaultSortC5.arr][a])
                    }
                    that[that.defaultSortC5.arr].length != 0 && that[that.defaultSortC5.arr].sort(compare(that.defaultSortC5.sort, that.defaultSortC5.lift, 'stockcode'))
                  })
                }
                that.statSortC5['flag'] = 'desc'
                that.statSortC5['value'] = 'huanshou'
                if (res.result.length == 0) {
                  that.pool5Empty = true
                }
                setTimeout(function () {
                  that.listenTabScroll()
                }, 50)
                that.pool5Loading = false
              }
              },
              function (err) {
                that.pool5Flag = true
                that.pool5Loading = false
              },null,true
          )
        }
        return {
          faucet: faucet,
          pool1: pool1,
          pool2: pool2,
          pool3: pool3,
          pool4:pool4,
          pool5:pool5,
        }
      },
      /**
       * 获取涨停基因的股票
       * asc升序，desc降序，默认是个股code升序
       */
      getGeneData: function () {
        var that = this
        // 接口1：获取我的自选股
        function getOwnStock(data, page) {
          var data = {
            op: data.op || 'getSelfStockList',
            orderBy: data.orderBy || 'stockCode',
            page: page || page,
            sortType: data.sortType || 'asc',
            direction: data.direction || 'down'
          }
          ajax(
            hxmConfig.baseApi,
            data,
            function (res) {
              if (res.code == 0) {
                $('#initLoading').addClass('hide')
                if (res.data.newPage.length == 0) {
                  that.ownEmpty = true
                  return
                }
                if (res.data.newPage.length < 50) {
                  that.bottomg1 = false
                  that.noMoreOwnStock = true
                  that.ownStock = res.data.newPage
                } else {
                  that.bottomg1 = true
                  that.ownStock = res.data.newPage
                }
              }
            },
            function (err) {
              $('#initLoading').addClass('hide')
              $('#errLoading').removeClass('hide')
            }
          )
        }
        // 接口2：获取全市场个股
        function getMarketStock(data, page) {
          var data = {
            op: data.op || 'getSelfStockList',
            orderBy: data.orderBy || 'stockCode',
            page: page || page,
            sortType: data.sortType || 'asc',
            direction: data.direction || 'down'
          }
          ajax(
            hxmConfig.baseApi,
            data,
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                $('#initLoading').addClass('hide')
                if (res.data.newPage.length == 0) {
                  that.marketEmpty = true
                  return
                }
                if (res.data.newPage.length < 50) {
                  that.bottomg2 = false
                  that.noMoreMarketStock = true
                  that.marketStock = res.data.newPage
                } else {
                  that.bottomg2 = true
                  that.marketStock = res.data.newPage
                }
              }
            },
            function (err) {
              $('#initLoading').addClass('hide')
              $('#errLoading').removeClass('hide')
            }
          )
        }
        return {
          getOwnStock: getOwnStock,
          getMarketStock: getMarketStock
        }
      },
      // 涨停监控接口数据
      getMonitor: function () {
        var that = this
        // 接口1：获取涨停监控数据:高度活跃个股和已关注个股
        function first() {
          ajax(
            hxmConfig.baseApi, {
              op: 'getEstimateLimitUpStock'
            },
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                $('#initLoading').addClass('hide')
                // 高度活跃个股
                if (res.data.preLimitStockList.length == 0) {
                  that.monitorArr2Empty = true
                  that[that.defaultSortM2.arr] = []
                } else {
                  that[that.defaultSortM2.arr] = res.data.preLimitStockList
                  that[that.defaultSortM2.arr].sort(compare(that.defaultSortM2.sort, that.defaultSortM2.lift, 'stockCode'))
                }
                // 已关注个股
                if (res.data.monitorStockList.length == 0) {
                  that.monitorArr3Empty = true
                  that[that.defaultSortM3.arr] = []
                } else {
                  var d = res.data.monitorStockList
                  for (var i = 0; i < d.length; i++) {
                    d[i]['limitRemind'] = true
                    that.monitorStocksCode.push(d[i].stockCode);
                  }
                  that[that.defaultSortM3.arr] = d
                  that[that.defaultSortM3.arr].sort(compare(that.defaultSortM3.sort, that.defaultSortM3.lift, 'stockCode'))
                }
                // 遍历设置状态
                var status = res.data.monitorStatus
                var setting = that.monitorSetting
                that.oldStatus = res.data.monitorStatus
                for (var i = 0; i < setting.length; i++) {
                  for (var j = 0; j < status.length; j++) {
                    if (setting[i]['value'] == status[j]) {
                      setting[i]['active'] = true
                      break
                    } else {
                      setting[i]['active'] = false
                    }
                  }
                }
                // 筛选高度活跃个股中已关注的 个股
                that.calcMonitorData().otherStock()
                // 是否已经点击了设置
                that.isFirstEnter = res.data.isFirstTime;
                if (that.isFirstEnter) {
                  that.floatButtonTxt = '确认并开启提醒'
                } else {
                  that.floatButtonTxt = '确认'
                }
                // 监听滚动事件
                setTimeout(function () {
                  that.listenTabScroll()
                }, 50)
                // 格式化刷新标志位
                that.monitorRefresh = false
              }
            },
            function (err) {
              that.monitorRefresh = false
              $('#initLoading').addClass('hide')
              $('#errLoading').removeClass('hide')
            }
          )
        }
        // 接口2：涨停监控的刷新
        function refresh(txt) {
          ajax(
            hxmConfig.baseApi, {
              op: 'getEstimateLimitUpStock'
            },
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                that.monitorRefresh = false
                // 点击刷新按钮的刷新
                if (!txt) {
                  new Toast('刷新成功', 1, 'c')
                }
                // 高度活跃个股
                if (res.data.preLimitStockList.length == 0) {
                  that.monitorArr2Empty = true
                  that[that.defaultSortM2.arr] = []
                } else {
                  that[that.defaultSortM2.arr] = res.data.preLimitStockList
                  that[that.defaultSortM2.arr].sort(compare(that.monitorRequestData2.orderBy, that.monitorRequestData2.lift, 'stockCode'))
                }
                // 已关注个股
                if (res.data.monitorStockList.length == 0) {
                  that.monitorArr3Empty = true
                  that[that.defaultSortM3.arr] = []
                } else {
                  var d = res.data.monitorStockList
                  for (var i = 0; i < d.length; i++) {
                    d[i]['limitRemind'] = true
                  }
                  that[that.defaultSortM3.arr] = d
                  that[that.defaultSortM3.arr].sort(compare(that.monitorRequestData3.orderBy, that.monitorRequestData3.lift, 'stockCode'))
                }
                // 遍历设置状态
                var status = res.data.monitorStatus
                var setting = that.monitorSetting
                for (var i = 0; i < setting.length; i++) {
                  for (var j = 0; j < status.length; j++) {
                    if (setting[i]['value'] == status[j]) {
                      setting[i]['active'] = true
                      break
                    } else {
                      setting[i]['active'] = false
                    }
                  }
                }
                // 筛选高度活跃个股中已关注的 个股
                that.calcMonitorData().otherStock()
                // 是否已经点击了设置
                that.isFirstEnter = res.data.isFirstTime;
                if (that.isFirstEnter) {
                  that.floatButtonTxt = '确认并开启提醒'
                } else {
                  that.floatButtonTxt = '确认'
                }
              }
            },
            function (err) {
              that.monitorRefresh = false
              $('#initLoading').addClass('hide')
              $('#errLoading').removeClass('hide')
            }
          )
        }
        /**
         *  接口3：涨停基因的订阅与取消订阅
         * @param {Object} item 当前点击的股票参数
         */
        function subscribe(item, index, txt) {
          var code = item.stockCode || item.stockcode
          var count = that.monitorStocksCode.length;
          const limitRemind = that.monitorStocksCode.indexOf(item.stockCode || item.stockcode) > -1;
          if (!limitRemind) {
            if (count < 30) {
              ajax(
                hxmConfig.baseApi,
                that.subscription,
                function (res) {
                  if (typeof res == 'string') {
                    res = JSON.parse(res)
                  }
                  if (res.code == 0) {
                    that.monitorStocksCode.push(that.subscription.stockCode);

                    that.subscription['op'] = 'cancelStockMonitor'
                    that.subscription['stockCode'] = code
                    if (txt == 'limitMonitor1') {
                      thsStats.clickStat('index', 'monitor.latent.open.' + (index + 1), {
                        targid: 'stock_' + code
                      })
                    } else if (txt == 'limitMonitor2') {
                      thsStats.clickStat('index', 'monitor.active.open.' + (index + 1), {
                        targid: 'stock_' + code
                      })
                    } else if (txt == 'limitMonitor3') {
                      thsStats.clickStat('index', 'monitor.follow.open.' + (index + 1), {
                        targid: 'stock_' + code
                      })
                    }

                    if (txt == 'limitMonitor3') {
                      that.calcMonitorData().follow2(item)
                    } else {
                      that.calcMonitorData().follow(item)
                    }
                  }
                },
                function (err) {
                  new Toast('网络异常', 1, 'c')
                }
              )
            } else {
              that.monitorMax30 = true;
            }
          } else {
            ajax(
              hxmConfig.baseApi,
              that.subscription,
              function (res) {
                if (typeof res == 'string') {
                  res = JSON.parse(res)
                }
                if (res.code == 0) {
                  const idxInMonitorList = that.monitorStocksCode.indexOf(that.subscription.stockCode);
                  idxInMonitorList > -1 && that.monitorStocksCode.splice(idxInMonitorList, 1);

                  that.subscription['op'] = 'setStockMonitor'
                  that.subscription['stockCode'] = code
                  if (txt == 'limitMonitor1') {
                    thsStats.clickStat('index', 'monitor.latent.close.' + (index + 1), {
                      targid: 'stock_' + code
                    })
                  } else if (txt == 'limitMonitor2') {
                    thsStats.clickStat('index', 'monitor.active.close.' + (index + 1), {
                      targid: 'stock_' + code
                    })
                  } else if (txt == 'limitMonitor3') {
                    thsStats.clickStat('index', 'monitor.follow.close.' + (index + 1), {
                      targid: 'stock_' + code
                    })
                  }
                  if (txt == 'limitMonitor3') {
                    that.calcMonitorData().unfollow2(item)
                  } else {
                    that.calcMonitorData().unfollow(item)
                  }
                }
              },
              function (err) {
                new Toast('网络异常', 1, 'c')
              }
            )
          }
        }
        /**
         * 接口4：涨停监控的设置参数请求
         * @param {Array} arr
         */
        function setting(arr) {
          var a = arr
          var obj = {}
          obj['op'] = 'setMonitorStatus'
          obj['statusId'] = (arr && arr.join(',')) || ''
          ajax(
            hxmConfig.baseApi,
            obj,
            function (res) {
              new Toast('设置成功', 1, 'c')
              var targid = 'remark_' + arr.join('-')
              if (that.monitorTab == 0) {
                thsStats.clickStat('index', 'monitor.latent.settx.ok', {
                  targid: targid
                })
              } else if (that.monitorTab == 1) {
                thsStats.clickStat('index', 'monitor.active.settx.ok', {
                  targid: targid
                })
              } else if (that.monitorTab == 2) {
                thsStats.clickStat('index', 'monitor.follow.settx.ok', {
                  targid: targid
                })
              }
              that.hasSetting = true
              that.oldStatus = a
            },
            function (err) {
              new Toast('网络异常', 1, 'c')
            },
            'post'
          )
        }
        return {
          subscribe: subscribe,
          refresh: refresh,
          first: first,
          setting: setting
        }
      },
      /*------所有的接口请求结束----------------------------------------------------------------------------------------------*/
      /*------所有的计算开始----------------------------------------------------------------------------------------------*/
      // 计算潜力连板个股的数据
      calculatePotentialData: function (data) {
        var that = this
        that.indexSummaryData.potential['arr'] = []
        var potentialArr = data || []
        if (potentialArr.length != 0) {
          var _stockcode = []
          var _marketcode = []
          for (var i = 0; i < potentialArr.length; i++) {
            _stockcode.push(potentialArr[i].stockcode)
            _marketcode.push(potentialArr[i].marketcode)
            potentialArr[i]['upRise'] = '--'
            potentialArr[i]['upRate'] = '--'
            potentialArr[i]['price'] = '--'
            if (!potentialArr[i]['ztyy']) {
              potentialArr[i]['ztyy'] = '--'
            }
          }
          if (getAppVersion()) {
            __getMarketInfo(['10', '34818', '48'], _stockcode, _marketcode, function (data) {
              var price = data['10']
              var upRate = data['48']
              var upRise = data['34818']
              for (var k = 0; k < _stockcode.length; k++) {
                potentialArr[k]['price'] = price[k] == '--' ? price[k] : parseFloat(price[k])
                potentialArr[k]['upRate'] = upRate[k] == '--' ? upRate[k] : parseFloat(upRate[k].split('%')[0])
                potentialArr[k]['upRise'] = upRise[k] == '--' ? upRise[k] : parseFloat(upRise[k].split('%')[0])
              }
              that.indexSummaryData.potential['arr'] = potentialArr
              that.calcMonitorData().potential(JSON.parse(JSON.stringify(that.indexSummaryData.potential['arr'])))
              potentialArr.sort(compare('upRise', 1, 'stockcode'))
            })
          } else {
            that.indexSummaryData.potential['arr'] = potentialArr
            that.indexSummaryData.potential.potentialLoading = false
            that.calcMonitorData().potential(JSON.parse(JSON.stringify(that.indexSummaryData.potential['arr'])))
            potentialArr.sort(compare(that.indexSummaryData.potential['sort'], 1, 'stockcode'))
          }
        } else {
          that.indexSummaryData.potential.potentialLoading = false
          that.monitorArr1Empty = true
          that.monitorArr1 = []
          that.indexSummaryData.potential['arr'] = []
          that.indexSummaryData.potential['empty'] = true
        }
      },
      // 计算市场龙头和当日复盘数据
      calculateCompoundData: function (cb) {
        var that = this
        var lastkey = ''
        for (var key in that.allCompoundArr) {
          lastkey = key
        }
        that.lastDay = Jen.transNumToDate(lastkey)
        that.selDay = that.lastDay
        ajax(hxmConfig.nextTradingApi,
          {date: that.lastDay,count: 1},
          function(result){
            if(result.errorCode == 0) {
              that.nextTradingDay = result.data.date.substring(5);
            }else {
              that.nextTradingDay = '明日';
            }
          },
          function(){
            that.nextTradingDay = '明日';
          }
        )
        // 最近一天的数据
        var recentData = that.allCompoundArr[lastkey] || []
        var tempLastkey = '__LIMITUPALLCOMPOUND__'
        // 把最近一天的数据存到localStorage
        // 用一个标志位存当天是几号，如果当天刷新了，存储也要刷新
        if (recentData.length != 0) {
          that.todayCompoundArr = recentData
          var _stockcode = []
          var _marketcode = []
          for (var i = 0; i < recentData.length; i++) {
            _stockcode.push(recentData[i].stockcode)
            _marketcode.push(recentData[i].marketcode)
            recentData[i]['upRise'] = '--'
            recentData[i]['upRate'] = '--'
            recentData[i]['price'] = '--'
            if (!recentData[i]['ztyy']) {
              recentData[i]['ztyy'] = '--'
            }
          }
          if (getAppVersion()) {
            __getMarketInfo(['10', '34818', '48'], _stockcode, _marketcode, function (data) {
              var price = data['10']
              var upRate = data['48']
              var upRise = data['34818']
              for (var k = 0; k < _stockcode.length; k++) {
                recentData[k]['price'] = price[k] == '--' ? price[k] : parseFloat(price[k])
                recentData[k]['upRate'] = upRate[k] == '--' ? upRate[k] : parseFloat(upRate[k].split('%')[0])
                recentData[k]['upRise'] = upRise[k] == '--' ? upRise[k] : parseFloat(upRise[k].split('%')[0])
              }
              that.indexSummaryData.faucet['arr'] = []
              for (var j = 0; j < recentData.length; j++) {
                if (recentData[j].lt == 1) {
                  that.indexSummaryData.faucet['arr'].push(recentData[j])
                }
              }
              that.indexSummaryData.faucet['arr'].sort(compare('upRise', 1, 'stockcode'))
              that.indexSummaryData.faucet.leaderLoading = false
              if (that.indexSummaryData.faucet['arr'].length == 0) {
                that.indexSummaryData.faucet['empty'] = true
              }
              localStorage.setItem(tempLastkey, JSON.stringify(recentData))
              localStorage.setItem(that.lastDayStorageName, lastkey)

              cb(); // s4()
            })
          } else {
            that.indexSummaryData.faucet['arr'] = []
            for (var j = 0; j < recentData.length; j++) {
              if (recentData[j].lt == 1) {
                that.indexSummaryData.faucet['arr'].push(recentData[j])
              }
            }
            that.indexSummaryData.faucet['arr'].sort(compare('upRise', 1, 'stockcode'))
            that.indexSummaryData.faucet.leaderLoading = false
            if (that.indexSummaryData.faucet['arr'].length == 0) {
              that.indexSummaryData.faucet['empty'] = true
            }

            localStorage.setItem(tempLastkey, JSON.stringify(recentData))
            localStorage.setItem(that.lastDayStorageName, lastkey)
          }
          // 处理涨停复盘tab的涨停复盘连板数据
          that.calcC1(lastkey)
        } else {
          that.indexSummaryData.faucet.leaderLoading = false
          that.indexSummaryData.faucet['arr'] = []
          that.indexSummaryData.faucet['empty'] = true
        }
      },
      // 处理涨停复盘tab的涨停复盘连板数据算法
      calcC1: function (lastkey) {
        var that = this
        var allData = that.allCompoundArr
        // 建架构
        for (var key in allData) {
          that.compoundObject1['detail'][key] = {}
          var tempkey = that.compoundObject1['detail'][key]
          for (var i = 0; i < allData[key].length; i++) {
            tempkey[allData[key][i].lbzs + ''] = []
          }
        }
        // 赋值：这个位置不能变
        var obj1 = that.compoundObject1['detail']
        for (var key2 in allData) {
          for (var j = 0; j < allData[key2].length; j++) {
            for (var key3 in obj1[key2]) {
              if (allData[key2][j].lbzs == key3 - 0) {
                obj1[key2][key3].push(allData[key2][j])
              }
            }
          }
        }
        // 排序
        var result = that.compoundObject1
        for (var key in result['detail']) {
          var a = []
          var o = {}
          for (var key2 in result['detail'][key]) {
            a.push(key2)
          }
          a.sort(function (a, b) {
            return b - a
          })
          for (var i = 0; i < a.length; i++) {
            o[',' + a[i] + ','] = result['detail'][key][a[i]]
          }
          result['detail'][key] = o
        }
        that.compoundObject1['current'] = that.compoundObject1['detail'][lastkey]
        // 初始化日历的
        that.initCalendar().c1(that.lastDay)
      },
      // 计算涨停监控的数据
      calcMonitorData: function () {
        var that = this
        // 潜力连板个股的
        function potential(data) {
          data = data || []
          if (data.length == 0) {
            that.monitorArr1Empty = true
            that.monitorArr1 = []
          } else {
            that.monitorArr1 = data
            for (var i = 0; i < that.monitorArr1.length; i++) {
              if (!that.monitorArr1[i].ztyy) {
                that.monitorArr1[i].ztyy = '--'
              }
            }
            that[that.defaultSortM1.arr].sort(compare(that.defaultSortM1.sort, that.defaultSortM1.lift, 'stockcode'))
            that.indexSummaryData.potential.potentialLoading = false
          }
        }
        // 高度活跃个股的
        function otherStock() {}
        // 先查我的关注里面是否有我现在点击的股票
        function searchIndex(item) {
          var index = null
          var compareArr = that.monitorArr3
          var code = item.stockCode || item.stockcode
          for (var i = 0; i < compareArr.length; i++) {
            if (compareArr[i].stockCode == code) {
              index = i
            }
          }
          return index
        }
        // 取消关注同步我的关注
        function unfollow(item) {
          var insertArr = that.monitorArr3
          var index = searchIndex(item)
          if (index != null) {
            that.$set(insertArr[index], 'limitRemind', false)
          }
        }
        // 添加关注同步我的关注
        function follow(item) {
          var index = searchIndex(item)
          var insertArr = that.monitorArr3
          if (index != null) {
            that.$set(insertArr[index], 'limitRemind', true)
          } else {
            var code = item.stockCode || item.stockcode
            var name = item.stockName || item.stockname
            var market = item.market || item.marketcode
            var current = item.upRise == undefined ? (item.currentIncrease == undefined ? (item.change == undefined ? item.change : 0) : item.currentIncrease) : item.upRise
            var price = item.price
            var addTime = +new Date()
            var limitRemind = true
            var stockObj = {}
            stockObj['stockName'] = name
            stockObj['stockCode'] = code
            stockObj['market'] = market
            stockObj['change'] = current
            stockObj['price'] = price
            stockObj['addTime'] = addTime
            stockObj['limitRemind'] = limitRemind
            if (insertArr.length == 0) {
              that.monitorArr3Empty = false
            }

            that.monitorArr3.push(stockObj)
            insertArr.sort(compare(that.monitorRequestData3.orderBy, that.monitorRequestData3.lift, 'stockCode'))
          }
        }
        // 我的关注的关注同步潜力连板和高度活跃
        function follow2(item) {
          var code = item.stockCode
          var index1 = null
          var index2 = null
          var arr1 = that.monitorArr1
          var arr2 = that.monitorArr2
          for (var i = 0; i < arr2.length; i++) {
            if (arr2[i].stockCode == code) {
              index2 = i
            }
          }
          for (var i = 0; i < arr1.length; i++) {
            if (arr1[i].stockcode == code) {
              index1 = i
            }
          }
          if (index2 != null) {
            that.$set(arr2[index2], 'limitRemind', true)
          }
          if (index1 != null) {
            that.$set(arr1[index1], 'limitRemind', true)
          }
        }
        // 我的关注的取消关注同步潜力连板和高度活跃
        function unfollow2(item) {
          var code = item.stockCode
          var index1 = null
          var index2 = null
          var arr1 = that.monitorArr1
          var arr2 = that.monitorArr2
          for (var i = 0; i < arr2.length; i++) {
            if (arr2[i].stockCode == code) {
              index2 = i
            }
          }
          for (var i = 0; i < arr1.length; i++) {
            if (arr1[i].stockcode == code) {
              index1 = i
            }
          }
          if (index2 != null) {
            that.$set(arr2[index2], 'limitRemind', false)
          }
          if (index1 != null) {
            that.$set(arr1[index1], 'limitRemind', false)
          }
        }
        return {
          potential: potential,
          otherStock: otherStock,
          unfollow: unfollow,
          follow: follow,
          unfollow2: unfollow2,
          follow2: follow2
        }
      },
      /*------所有的计算结束----------------------------------------------------------------------------------------------*/
      /**
       * 所有的排序管理
       * @param {String} from 是哪种排序：请求接口的排序还是前端排序
       * @param {Number} index index 点击第index个
       * @param {String} value value 第index个的排序关键字
       * @param {String} arr 排哪个数组
       * @param {String} lift 升降序数组
       * @param {String} number 所有类型排序的标志位
       * sort排序方式 1-(数组长度*2-1)分别代表种类型的升降序 偶数时升序，奇数是升序
       */
      sort: function (from, index, value, arr, lift, number) {
        var that = this
        var arrname = arr
        var arr = that[arr]
        var lift = that[lift]
        // 如果是时间，那就不排序
        if (value == 'scztsj' || value == 'zzdtsj' || value == 'scdtsj') {
          return
        }
        for (var i = 0; i < lift.length; i++) {
          if (index == i) {
            if (!lift[i]) lift[i] = 'up'
            if (lift[i] == 'down') {
              lift[i] = 'up'
              that[number] = i * 2
            } else {
              lift[i] = 'down'
              that[number] = i * 2 + 1
            }
            continue
          } else {
            lift[i] = ''
          }
        }
        // 这个位置不能变
        var sort = that[number]
        if (from == 'normal') {
          var flag
          if (index * 2 + 1 == sort) {
            flag = 1
          } else if (index * 2 == sort) {
            flag = -1
          }
          if ((value == 'price' || value == 'upRise') && !getAppVersion()) {
            return
          }else if(value == 'kbts'){
            if(arr.length !=0){
              that.calcSortStat().pool(arrname, flag, value)
              var hanziArr = arr.filter((currentValue)=>{
                return typeof currentValue[value] != 'number'
              })
              var numberArr = arr.filter((currentValue)=>{
                return typeof currentValue[value] == 'number'
              })
              if(numberArr.length != 0){
                  numberArr.sort(compare(value, flag, 'stockcode'))
                  that['poolArr1'] = hanziArr.length != 0 ? numberArr.concat(hanziArr) : numberArr
              }
            }
          }else if(value == 'industryname'){
              that.calcSortStat().pool(arrname, flag, value)
              arr.length != 0 && that.sortHanzi(arr, value, flag)
          }else{
            that.calcSortStat().pool(arrname, flag, value)
            arr.length != 0 && arr.sort(compare(value, flag, 'stockcode'))
          }
        } else if (from == 'monitorSpecial') {
          // 涨停监控的高度活跃个股的排序参数
          var flag
          if (index * 2 + 1 == sort) {
            flag = 1
          } else if (index * 2 == sort) {
            flag = -1
          }
          arr.length != 0 && arr.sort(compare(value, flag, 'stockCode'))
          that.monitorRequestData2['orderBy'] = value
          that.monitorRequestData2['sort'] = sort
          that.monitorRequestData2['index'] = index
          that.monitorRequestData2['lift'] = flag
          var v
          if (that.monitorRequestData2.orderBy == 'currentIncrease') {
            v = 'current'
            that.monitorRequestData2['label'] = v
          } else if (that.monitorRequestData2.orderBy == 'fiveMinRise') {
            v = 'fivemin'
            that.monitorRequestData2['label'] = v
          } else if (that.monitorRequestData2.orderBy == 'sellPower') {
            v = 'sell'
            that.monitorRequestData2['label'] = v
          } else if (that.monitorRequestData2.orderBy == 'buyPower') {
            v = 'buy'
            that.monitorRequestData2['label'] = v
          } else if (that.monitorRequestData2.orderBy == 'todayMaxRise') {
            v = 'maxrise'
            that.monitorRequestData2['label'] = v
          } else if (that.monitorRequestData2.orderBy == 'limitGene') {
            v = 'jiyin'
            that.monitorRequestData2['label'] = v
          }
          if (flag == 1) {
            thsStats.clickStat('index', 'monitor.active.' + v + '.desc')
          } else if (flag == -1) {
            thsStats.clickStat('index', 'monitor.active.' + v + '.asc')
          }
        } else if (from == 'monitorPotential') {
          // 涨停监控的潜力连板个股的排序参数
          if ((value == 'price' || value == 'upRate' || value == 'upRise') && !getAppVersion()) {
            return
          } else {
            var flag, v
            if (index * 2 + 1 == sort) {
              flag = 1
            } else if (index * 2 == sort) {
              flag = -1
            }
            if (value == 'ztyy') {
              arr.length != 0 && that.sortHanzi(arr, value, flag)
            } else {
              arr.length != 0 && arr.sort(compare(value, flag, 'stockcode'))
            }
            that.monitorRequestData1['orderBy'] = value
            that.monitorRequestData1['sort'] = sort
            that.monitorRequestData1['index'] = index
            that.monitorRequestData1['lift'] = flag
            switch (value) {
              case 'lbzs':
                v = 'lianban'
                that.monitorRequestData1['label'] = v
                break
              case 'ztgl':
                v = 'ztgailv'
                that.monitorRequestData1['label'] = v
                break
              case 'ztyy':
                v = 'ztyuanyin'
                that.monitorRequestData1['label'] = v
                break
              case 'upRise':
                v = 'zhangfu'
                that.monitorRequestData1['label'] = v
                break
              case 'upRate':
                v = 'zhangsu'
                that.monitorRequestData1['label'] = v
                break
              case 'price':
                v = 'zuixin'
                that.monitorRequestData1['label'] = v
                break
              default:
                break
            }
            if (flag == 1) {
              thsStats.clickStat('index', 'monitor.latent.' + v + '.desc')
            } else if (flag == -1) {
              thsStats.clickStat('index', 'monitor.latent.' + v + '.asc')
            }
          }
        }
      },
      // 汉字排序 type：1从大到小 -1从小到大 arr数组 key关键字
      sortHanzi: function (arr, key, way) {
        arr.sort(function (a, b) {
          if (a[key] && b[key]) {
            return -compareInPinYin(a[key], b[key]) * way
          }
        })
      },
      // 计算三个池的埋点
      calcSortStat: function () {
        var that = this

        function pool(arr, flag, value) {
          var name = ''
          if (flag == 1) {
            that.statSortC1['flag'] = 'desc'
          } else {
            that.statSortC1['flag'] = 'asc'
          }
          if (arr == 'poolArr1') {
            name = 'statSortC1'
          } else if (arr == 'poolArr2') {
            name = 'statSortC2'
          } else if (arr == 'poolArr3') {
            name = 'statSortC3'
          }else if(arr == 'poolArr4'){
            name = 'statSortC4'
          }else if(arr == 'poolArr5'){
            name = 'statSortC5'
          }
          switch (value) {
            case 'price':
              that[name]['value'] = 'zuixin'
              break
            case 'upRise':
              that[name]['value'] = 'zhangdie'
              break
            case 'hsl':
              that[name]['value'] = 'huanshou'
              break
            case 'ssts':
              that[name]['value'] = 'shangshi'
              break
            case 'kbts':
              that[name]['value'] = 'kaiban'
              break
            case 'zdsy':
              that[name]['value'] = 'shouyi'
              break
            case 'jye':
              that[name]['value'] = 'chengjiaoe'
              break
            case 'jyl':
              that[name]['value'] = 'chegnjiao'
              break
            case 'cje':
              that[name]['value'] = 'chengjiaoe'
              break
            case 'cjl':
              that[name]['value'] = 'chegnjiao'
              break
            case 'ltz':
              that[name]['value'] = 'liutong'
            case 'ltsz':
              that[name]['value'] = 'liutong'
              break
            case 'zsz':
              that[name]['value'] = 'zongshizhi'
              break
            case 'isopen':
              that[name]['value'] = 'sfkaiban'
              break
            case 'lbzs':
              that[name]['value'] = 'lianban'
              break
            default:
              break
          }
          if (name == 'statSortC1') {
            thsStats.clickStat('index', 'replay.new.' + that[name]['value'] + '.' + that[name]['flag'])
          } else if (name == 'statSortC2') {
            thsStats.clickStat('index', 'replay.rise.' + that[name]['value'] + '.' + that[name]['flag'])
          } else if (name == 'statSortC3') {
            thsStats.clickStat('index', 'replay.fall.' + that[name]['value'] + '.' + that[name]['flag'])
          }
        }
        return {
          pool: pool
        }
      },
      // 已关注个股的排序:是特殊的排序，所以不跟sort放在一块，因为包含了时间戳的排序
      monitorSort: function (index, lift, number) {
        var that = this
        var lift = that[lift]
        for (var i = 0; i < lift.length; i++) {
          if (index == i) {
            if (!lift[i]) {
              lift[i] = 'down'
              that[number] = i * 2 + 1
            } else if (lift[i] == 'down') {
              lift[i] = 'up'
              that[number] = i * 2
            } else if (lift[i] == 'up') {
              lift[i] = ''
              that[number] = -1
            }
            continue
          } else {
            lift[i] = ''
          }
        }
        var sort = that[number]
        // 这个默认为1是为了排用户的关注顺序
        var flag = 1
        var v
        var arr = that[that.monitorRequestData3['arr']]
        if (index * 2 + 1 == sort) {
          flag = 1
        } else if (index * 2 == sort) {
          flag = -1
        }
        that.monitorRequestData3['index'] = index
        that.monitorRequestData3['sort'] = sort
        that.monitorRequestData3['lift'] = flag
        switch (sort) {
          case 0:
            that.monitorRequestData3['orderBy'] = 'change'
            v = 'current'
            that.monitorRequestData3['label'] = v
            break
          case 1:
            that.monitorRequestData3['orderBy'] = 'change'
            v = 'current'
            that.monitorRequestData3['label'] = v
            break
          case 2:
            that.monitorRequestData3['orderBy'] = 'price'
            v = 'zuixin'
            that.monitorRequestData3['label'] = v
            break
          case 3:
            that.monitorRequestData3['orderBy'] = 'price'
            v = 'zuixin'
            that.monitorRequestData3['label'] = v
            break
          case -1:
            that.monitorRequestData3['orderBy'] = 'addTime'
            v = 'moren'
            that.monitorRequestData3['label'] = v
            break
          default:
            break
        }
        arr.length != 0 && arr.sort(compare(that.monitorRequestData3['orderBy'], flag, 'stockCode'))
        if (v == 'moren') {
          thsStats.clickStat('index', 'monitor.follow.' + v + '.paixu')
        } else {
          if (flag == 1) {
            thsStats.clickStat('index', 'monitor.follow.' + v + '.desc')
          } else if (flag == -1) {
            thsStats.clickStat('index', 'monitor.follow.' + v + '.asc')
          }
        }
      },
      // 涨停基因排序
      geneSort: function (index, lift, number) {
        $(window).scrollTop(0)
        var that = this
        var lift = that[lift]
        for (var i = 0; i < lift.length; i++) {
          if (index == i) {
            if (!lift[i]) {
              lift[i] = 'down'
              that[number] = i * 2 + 1
            } else if (lift[i] == 'down') {
              lift[i] = 'up'
              that[number] = i * 2
            } else if (lift[i] == 'up') {
              lift[i] = ''
              that[number] = -1
            }
            continue
          } else {
            lift[i] = ''
          }
        }
        // 这个位置不能变
        var sort = that[number]
        that.updateSort().manyData(this.geneTab, index, sort)
      },
      // 涨停基因更新排序状态:后端接口排序
      updateSort: function () {
        var that = this
        // 接口1：涨停基因的后端接口排序
        function manyData(tab, index, sort) {
          that.geneRequestData['direction'] = 'down'
          switch (sort) {
            case 0:
              that.geneRequestData['orderBy'] = 'score'
              that.geneRequestData['sortType'] = 'asc'
              break
            case 1:
              that.geneRequestData['orderBy'] = 'score'
              that.geneRequestData['sortType'] = 'desc'
              break
            case 2:
              that.geneRequestData['orderBy'] = 'price'
              that.geneRequestData['sortType'] = 'asc'
              break
            case 3:
              that.geneRequestData['orderBy'] = 'price'
              that.geneRequestData['sortType'] = 'desc'
              break
            case 4:
              that.geneRequestData['orderBy'] = 'change'
              that.geneRequestData['sortType'] = 'asc'
              break
            case 5:
              that.geneRequestData['orderBy'] = 'change'
              that.geneRequestData['sortType'] = 'desc'
              break
            case -1:
              that.geneRequestData['orderBy'] = 'stockCode'
              that.geneRequestData['sortType'] = 'asc'
              break
            default:
              break
          }
          if (tab == 0) {
            that.geneRequestData['op'] = 'getSelfStockList'
            that.ownPage = 1
            that.bottomg1 = true
            var value
            if (that.geneRequestData.orderBy == 'stockCode') {
              value = 'code'
              thsStats.clickStat('index', 'gene.my.' + value + '.unsort')
            } else if (that.geneRequestData.orderBy == 'score') {
              value = 'jiyin'
              thsStats.clickStat('index', 'gene.my.' + value + '.' + that.geneRequestData.sortType)
            } else if (that.geneRequestData.orderBy == 'price') {
              value = 'jiage'
              thsStats.clickStat('index', 'gene.my.' + value + '.' + that.geneRequestData.sortType)
            } else if (that.geneRequestData.orderBy == 'change') {
              value = 'zhangfu'
              thsStats.clickStat('index', 'gene.my.' + value + '.' + that.geneRequestData.sortType)
            }
            that.getGeneData().getOwnStock(that.geneRequestData, that.ownPage)
          } else {
            that.geneRequestData['op'] = 'getStockList'
            that.marketPage = 1
            that.bottomg2 = true
            var value
            if (that.geneRequestData.orderBy == 'stockCode') {
              value = 'code'
              thsStats.clickStat('index', 'gene.all.' + value + '.unsort')
            } else if (that.geneRequestData.orderBy == 'score') {
              value = 'jiyin'
              thsStats.clickStat('index', 'gene.all.' + value + '.' + that.geneRequestData.sortType)
            } else if (that.geneRequestData.orderBy == 'price') {
              value = 'jiage'
              thsStats.clickStat('index', 'gene.all.' + value + '.' + that.geneRequestData.sortType)
            } else if (that.geneRequestData.orderBy == 'change') {
              value = 'zhangfu'
              thsStats.clickStat('index', 'gene.all.' + value + '.' + that.geneRequestData.sortType)
            }
            that.getGeneData().getMarketStock(that.geneRequestData, that.marketPage)
          }
        }
        return {
          manyData: manyData
        }
      },
      // 监听折叠面板的滚动事件
      listenTabScroll: function () {
        // 涨停复盘的哪个list
        var $list = $('.limitCompound .detail .type3 .list,.limitCompound .detail .type4 .list,.limitCompound .detail .type5 .list, .limitMonitor .detail .type1 .list, .limitMonitor .detail .type2 .list, .limitSummary .potentialStock .detail, .limitSummary .marketLeader .detail')
        if (this.isReplaceShadow) {
          var shadowName = 'replaceShadow'
        } else {
          var shadowName = 'shadow'
        }
        // 左右滑动监控
        $list.find('.list-r').on('scroll', function () {
          if ($(this).scrollLeft() > 0) {
            $(this)
              .parent()
              .find('.list-l')
              .addClass(shadowName)
            $(this)
              .parent()
              .find('.smallTriangle')
              .hide()
          } else {
            $(this)
              .parent()
              .find('.list-l')
              .removeClass(shadowName)
              .addClass('shadowNameWhite')
            $(this)
              .parent()
              .find('.smallTriangle')
              .show()
          }
        })
      },
      // 滑动到底部监听事件管理
      listenBottomEvent: function () {
        var that = this
        var bottoms1 = true
        var bottomc1 = true
        var bottomc2 = true
        var bottomc3 = true
        var bottomc4 = true
        var bottomc5 = true
        var bottomg1 = true
        var bottomg2 = true
        var bottomg3 = true
        var bottomm1 = true
        var bottomm2 = true
        var bottomm3 = true
        // 页面滚动监控
        $(window).on('scroll', function () {
          var dpr = $('html').data('dpr') ? $('html').data('dpr') : 1
          var windowHeight = getPlatform() == 'iphone' ? window.screen.height : $(window).height() //window高度
          var scrollHeight = $(window).scrollTop() / dpr //window距顶部距离
          var totalHeight = $('body').height() / dpr //页面总高度
          if (scrollHeight + 10 >= totalHeight - windowHeight && scrollHeight != 0) {
            if (that.currentTab == 0 && bottoms1) {
              thsStats.clickStat('index', 'outline.bottom')
              bottoms1 = false
            } else if (that.currentTab == 1) {
              if (that.currentTag == 0 && bottomc1) {
                thsStats.clickStat('index', 'replay.fupan.bottom')
                bottomc1 = false
              } else if (that.currentTag == 1 && bottomc2) {
                thsStats.clickStat('index', 'replay.longtou.bottom')
                bottomc2 = false
              } else if (that.currentTag == 2 && bottomc3) {
                thsStats.clickStat('index', 'replay.new.bottom')
                bottomc3 = false
              } else if (that.currentTag == 3 && bottomc4) {
                thsStats.clickStat('index', 'replay.rise.bottom')
                bottomc4 = false
              } else if (that.currentTag == 4 && bottomc5) {
                thsStats.clickStat('index', 'replay.fall.bottom')
                bottomc5 = false
              }
            } else if (that.currentTab == 2) {
              if (that.geneTab == 0 && !that.inSearch) {
                if (that.bottomg1) {
                  that.getGeneMoreData().own()
                  that.bottomg1 = false
                }
                if (that.noMoreOwnStock && bottomg1) {
                  thsStats.clickStat('index', 'gene.my.bottom')
                  bottomg1 = false
                }
              } else if (that.geneTab == 1 && !that.inSearch) {
                if (that.bottomg2) {
                  that.getGeneMoreData().market()
                  that.bottomg2 = false
                }
                if (that.noMoreMarketStock && bottomg2) {
                  thsStats.clickStat('index', 'gene.all.bottom')
                  bottomg2 = false
                }
              } else if (that.inSearch) {
                if (bottomg3) {
                  thsStats.clickStat('index', 'search.bottom')
                  bottomg3 = false
                }
              }
            } else if (that.currentTab == 3) {
              if (that.monitorTab == 0 && bottomm1) {
                thsStats.clickStat('index', 'monitor.latent.bottom')
                bottomm1 = false
              }
              if (that.monitorTab == 1 && bottomm2) {
                thsStats.clickStat('index', 'monitor.acitve.bottom')
                bottomm2 = false
              }
              if (that.monitorTab == 2 && bottomm3) {
                thsStats.clickStat('index', 'monitor.follow.bottom')
                bottomm3 = false
              }
            }
          }
        })
      },
      // 涨停基因到底部加载
      getGeneMoreData: function () {
        var that = this
        // 接口1：自选股滑动到底部
        function own() {
          thsStats.clickStat('index', 'gene.my.load.' + that.ownPage)
          that.ownPage++
          that.geneRequestData['page'] = that.ownPage
          ajax(
            hxmConfig.baseApi,
            that.geneRequestData,
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                if (res.data.newPage.length < 50) {
                  that.ownStock = that.ownStock.concat(res.data.newPage)
                  that.bottomg1 = false
                  that.noMoreOwnStock = true
                } else {
                  that.bottomg1 = true
                  that.ownStock = that.ownStock.concat(res.data.newPage)
                }
              }
            },
            function (err) {}
          )
        }
        // 接口2：全市场滑动到底部
        function market() {
          thsStats.clickStat('index', 'gene.all.load.' + that.marketPage)
          that.marketPage++
          that.geneRequestData['page'] = that.marketPage
          ajax(
            hxmConfig.baseApi,
            that.geneRequestData,
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                if (res.data.newPage.length < 50) {
                  that.marketStock = that.marketStock.concat(res.data.newPage)
                  that.bottomg2 = false
                  that.noMoreMarketStock = true
                } else {
                  that.bottomg2 = true
                  that.marketStock = that.marketStock.concat(res.data.newPage)
                }
              }
            },
            function (err) {}
          )
        }
        return {
          own: own,
          market: market
        }
      },
      // 涨停监控订阅点击
      toSubscribe: function (txt, item, index) {
        var code = item.stockcode || item.stockCode;
        // 如果是第一次进入的已订阅的个数一定是小于30的，所以不用判断是否小于30
        if (this.isFirstEnter) {
          $('.limitMonitor .slideBg').addClass('showSlideBg')
          $('.limitMonitor .slideNav').addClass('slideFloat')
          $('.limitMonitor .slideNav').removeClass('slideFloatback')
          if (txt == 'limitMonitor1') {
            thsStats.clickStat('index', 'monitor.latent.settx.show')
          } else if (txt == 'limitMonitor2') {
            thsStats.clickStat('index', 'monitor.active.settx.show')
          } else if (txt == 'limitMonitor3') {
            thsStats.clickStat('index', 'monitor.follow.settx.show')
          }
          this.isFirstEnter = false;
        }
        if (this.monitorStocksCode.indexOf(item.stockCode || item.stockcode) === -1) {
          this.subscription['op'] = 'setStockMonitor'
        } else {
          this.subscription['op'] = 'cancelStockMonitor'
        }
        this.subscription['stockCode'] = code;
        if (txt !== 'limitMonitor3') {
          this.needUpdateMonitorStocks = true;
        }
        this.getMonitor().subscribe(item, index, txt)
      },
      // 涨停监控的设置按钮
      toSetting: function (txt) {
        var that = this
        if (txt == 'type1') {
          thsStats.clickStat('index', 'monitor.latent.settx')
          thsStats.clickStat('index', 'monitor.latent.settx.show')
        } else if (txt == 'type2') {
          thsStats.clickStat('index', 'monitor.active.settx')
          thsStats.clickStat('index', 'monitor.active.settx.show')
        } else if (txt == 'type3') {
          thsStats.clickStat('index', 'monitor.follow.settx')
          thsStats.clickStat('index', 'monitor.follow.settx.show')
        }
        if (this.isFirstEnter) {
          this.isFirstEnter = false
        } else {
          if (!this.hasSetting) {
            var status = that.oldStatus
            var setting = that.monitorSetting
            for (var i = 0; i < setting.length; i++) {
              for (var j = 0; j < status.length; j++) {
                if (setting[i]['value'] == status[j]) {
                  setting[i]['active'] = true
                  break
                } else {
                  setting[i]['active'] = false
                }
              }
            }
          }
        }
        $('.limitMonitor .slideBg').addClass('showSlideBg')
        $('.limitMonitor .slideNav').addClass('slideFloat')
        $('.limitMonitor .slideNav').removeClass('slideFloatback')
      },
      // 取消设置
      cancelSetting: function () {
        $('.limitMonitor .slideNav').removeClass('slideFloat')
        $('.limitMonitor .slideNav').addClass('slideFloatback')
        $('.limitMonitor .slideBg').removeClass('showSlideBg')
      },
      // 确定设置
      confirmSetting: function () {
        var arr = []
        var setting = this.monitorSetting
        for (var i = 0; i < setting.length; i++) {
          if (setting[i]['active']) {
            arr.push(setting[i]['value'])
          }
        }
        this.getMonitor().setting(arr)
        $('.limitMonitor .slideNav').removeClass('slideFloat')
        $('.limitMonitor .slideNav').addClass('slideFloatback')
        $('.limitMonitor .slideBg').removeClass('showSlideBg')
        this.floatButtonTxt = '确认'
      },

      // 选中当前的指标
      toChecked: function (item, index) {
        item.active = true
        this.hasSetting = false
      },
      // 取消选中当前的指标
      toCancelChecked: function (item, index) {
        item.active = false
        this.hasSetting = false
      },
      /*涨停基因和涨停监控的刷新管理 */
      refresh: function (from, txt) {
        var that = this
        if (from == 'gene') {
          $(window).scrollTop(0)
          if (that.geneTab == 0) {
            that.geneRequestData['op'] = 'getSelfStockList'
            that.ownRefresh = true
            thsStats.clickStat('index', 'gene.my.refresh')
            that.recursiveRefresh(1, txt, 0, that.ownPage)
          } else {
            that.geneRequestData['op'] = 'getStockList'
            that.marketRefresh = true
            thsStats.clickStat('index', 'gene.all.refresh')
            that.recursiveRefresh(1, txt, 1, that.marketPage)
          }
        } else if (from == 'monitor') {
          if (that.monitorTab == 0) {
            if (!getAppVersion()) {
              return
            } else {
              that.monitorRefresh = true
              thsStats.clickStat('index', 'monitor.latent.refresh')
              // 客户端获取行情然后进行排序
              that.hqRefresh().potential('limitMonitor', txt)
            }
          } else {
            that.monitorRefresh = true
            that.getMonitor().refresh(txt)
            if (that.monitorTab == 1) {
              thsStats.clickStat('index', 'monitor.active.refresh')
            } else {
              thsStats.clickStat('index', 'monitor.follow.refresh')
            }
          }
        }
      },
      // 潜力连板市场龙头的客户端行情数据刷新
      hqRefresh: function () {
        var that = this

        function potential(from, txt) {
          var refreshArr = []
          var inter = []
          var _stockcode = []
          var _marketcode = []
          if (from == 'limitSummary') {
            var arr1 = that.indexSummaryData.potential['arr'] || []
            var arr2 = that.indexSummaryData.faucet['arr'] || []
            var len = [arr1.length, arr2.length]
            var all = []
            var s = 0
            var e = arr1.length
            for (var i = 0; i < len.length; i++) {
              var obj = {}
              if (i == 0) {
                obj['s'] = s
                obj['e'] = e
              } else {
                s = s + len[i - 1]
                e = e + len[i]
                obj['s'] = s
                obj['e'] = e
              }
              inter.push(obj)
            }
            all = all.concat(arr1).concat(arr2)
            refreshArr = all
          } else if (from == 'limitMonitor') {
            refreshArr = that.monitorArr1
            if (refreshArr.length == 0) {
              that.monitorRefresh = false
            }
          }
          if (refreshArr.length != 0) {
            for (var i = 0; i < refreshArr.length; i++) {
              _stockcode.push(refreshArr[i].stockcode)
              _marketcode.push(refreshArr[i].marketcode)
            }
            if (getAppVersion()) {
              __getMarketInfo(['10', '34818', '48'], _stockcode, _marketcode, function (data) {
                var price = data['10']
                var upRate = data['48']
                var upRise = data['34818']
                for (var k = 0; k < _stockcode.length; k++) {
                  refreshArr[k]['price'] = price[k] == '--' ? price[k] : parseFloat(price[k])
                  refreshArr[k]['upRate'] = upRate[k] == '--' ? upRate[k] : parseFloat(upRate[k].split('%')[0])
                  refreshArr[k]['upRise'] = upRise[k] == '--' ? upRise[k] : parseFloat(upRise[k].split('%')[0])
                }
                if (from == 'limitSummary') {
                  that.indexSummaryData.potential['arr'] = refreshArr.slice(inter[0].s, inter[0].e)
                  that.indexSummaryData.faucet['arr'] = refreshArr.slice(inter[1].s, inter[1].e)
                  that.indexSummaryData.potential['arr'].sort(compare('upRise', 1, 'stockcode'))
                  that.indexSummaryData.faucet['arr'].sort(compare('upRise', 1, 'stockcode'))
                } else if (from == 'limitMonitor') {
                  that.monitorRefresh = false
                  var value = that.monitorRequestData1.orderBy
                  var flag = that.monitorRequestData1.lift
                  if (value == 'ztyy') {
                    that.sortHanzi(refreshArr, value, flag)
                  } else {
                    refreshArr.sort(compare(value, flag, 'stockcode'))
                  }
                  if (txt != 'tab4') {
                    new Toast('刷新成功', 1, 'c')
                  }
                }
              })
            }
          }
        }
        return {
          potential: potential
        }
      },
      // 涨停基因的递归刷新
      recursiveRefresh: function (j, txt, tab, page) {
        var that = this
        if (j <= page) {
          that.geneRefresh(tab, j, function (num) {
            if (num == page) {
              if (tab == 0) {
                that.ownStock = that.refreshOwnStock
                that.refreshOwnStock = []
                that.ownRefresh = false
              } else {
                that.marketStock = that.refreshMarketStock
                that.refreshMarketStock = []
                that.marketRefresh = false
              }
              if (txt != 'tab3') {
                new Toast('刷新成功', 1, 'c')
              }
            }
            setTimeout(function () {
              that.recursiveRefresh(++j, txt, tab, page)
            }, 500)
          })
        } else {
          return
        }
      },
      // 涨停基因的刷新函数
      geneRefresh: function (tab, page, cb) {
        var that = this
        var data = {
          op: that.geneRequestData.op,
          orderBy: that.geneRequestData.orderBy,
          page: page,
          sortType: that.geneRequestData.sortType,
          direction: that.geneRequestData.direction
        }
        if (tab == 0) {
          ajax(
            hxmConfig.baseApi,
            data,
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                that.refreshOwnStock = that.refreshOwnStock.concat(res.data.newPage)
                cb(page)
              }
            },
            function (err) {
              that.ownRefresh = false
              new Toast('网络异常', 1, 'c')
            }
          )
        } else if (tab == 1) {
          ajax(
            hxmConfig.baseApi,
            data,
            function (res) {
              if (typeof res == 'string') {
                res = JSON.parse(res)
              }
              if (res.code == 0) {
                that.refreshMarketStock = that.refreshMarketStock.concat(res.data.newPage)
                cb(page)
              }
            },
            function (err) {
              that.marketRefresh = false
              new Toast('网络异常', 1, 'c')
            }
          )
        }
      },
      // 首页的刷新
      indexRefresh: function () {
        var that = this
        var limitSummary = document.getElementById('limitSummary')
        // 处理下拉刷新成功
        function handlePullDownSuccess() {
          pullInstance.pullDownSuccess()
        }
        // 处理下拉刷新失败
        function handlePullDownFailed() {
          pullInstance.pullDownFailed()
        }
        const pullInstance = new window.Pull('limitSummary', {
          // 下拉刷新回调方法，如果不存在该方法，则不加载下拉dom
          onPullDown: function () {
            that.getSummaryData().s1(
              function (res) {
                that.getSummaryData().s3(res);
                handlePullDownSuccess()
              },
              function (res) {
                handlePullDownFailed()
              }
            )
            that.hqRefresh().potential('limitSummary')
            thsStats.clickStat('index', 'outline.refresh')
          }
        })
      },
      // 搜索接口
      searchStock: function (val) {
        var that = this
        if (val == '') {
          return
        }
        var data = {
          op: 'searchStock',
          pattern: val
        }
        ajax(
          hxmConfig.baseApi,
          data,
          function (res) {
            if (typeof res == 'string') {
              res = JSON.parse(res)
            }
            if (res.code == 0) {
              if ((res.data && res.data.length == 0) || !res.data) {
                that.searchEmpty = true
              }
              if (res.data && res.data.length != 0) {
                that.searchEmpty = false
              }
              that.searchArr = res.data || []
            }
          },
          function (err) {
            new Toast('网络异常', 1, 'c')
          }
        )
      },
      // 点击搜索
      toSeach: function () {
        this.inSearch = true
        $('body').addClass('bg')
        thsStats.clickStat('index', 'gene.search')
      },
      // 点击搜索结果
      clickSearchResult: function (item, index) {
        this.jump('search', item, index)
      },
      // 点击取消
      toCancel: function () {
        this.inSearch = false
        this.stockSearch = ''
        $('body').removeClass('bg')
        thsStats.clickStat('index', 'gene.cancel')
      },
      // 清空按钮
      toClear: function () {
        this.stockSearch = ''
      },
      // 重新加载
      reload: function () {
        var that = this
        $('#errLoading').addClass('hide')
        $('#initLoading').removeClass('hide')
        if (this.currentTab == 0) {
          // 首页接口
          that.getSummaryData().s1(
            function (res) {
              that.getMonitor().first();
              that.getSummaryData().s2(function(){
                that.getSummaryData().s4();
              },function(){
                that.getSummaryData().s4();
              })
              that.getSummaryData().s3(res);
            },
            function (res) {})
        } else if (this.currentTab == 1) {
          if (this.currentTag == 0) {
            this.getCompoundAllData().faucet()
          }
        } else if (this.currentTab == 2) {
          if (this.geneTab == 0) {
            this.geneRequestData['op'] = 'getSelfStockList'
            this.getGeneData().getOwnStock(this.geneRequestData, this.ownPage)
          } else {
            this.geneRequestData['op'] = 'getStockList'
            this.getGeneData().getMarketStock(this.geneRequestData, this.marketPage)
          }
        } else if (this.currentTab == 3) {
          this.getMonitor().first()
        }
      },
      caclDateType: function(ctime){
        // 判断当前时间和涨停复盘推荐股票的推荐时间关系
        var dateArr = ctime.split(" ")[0].split("-");
        var year = Number(dateArr[0]);
        var month = Number(dateArr[1])-1;
        var day = Number(dateArr[2]);
        var time1 = new Date(year, month, day).getTime(); // 得到零点时间戳
        var time2 = new Date().getTime(); // 当前时间戳

        var dayTime = 86400000; // 24小时
        var oneTime = 55800000; // 15:30
        var twoTime = 59400000; // 16:30
        var threeTime = 63000000; // 17:30

        if(time2 - time1 >= dayTime){
          // 超过1天/隔日
          if(ctime.split(" ")[0] == this.lastDay) {
            // 当前的数据为最后(最近)一天的数据
            return '0';
          }
          return '1';
        } else if(time2 - time1 >= threeTime){
          // 当天17:30之后
          return '2';
        } else if(time2 - time1 >= twoTime){
          // 当天16:30~17:30之间
          return '3';
        } else if(time2 - time1 >= oneTime){
          // 当天15:30~16:30之间
          return '4';
        } else {
          // 当天15:30之前
          return '5';
        }
      },
      //判断用户是否已经添加微信
      _getAddWechatStatus() {
        $.ajax({
          type: 'get',
          url: hxmConfig.judgeWeChat,
          xhrFields: {
            withCredentials: true, //允许跨域携带Cookie
          },
          success: res => {
            if (+res.status_code !== 0 || !res.data) {
              this.isAddWeChat = true; //如果异常，按添加过微信来处理
            } else {
              const wxFlag = res.data.wx_flag;
              // 未添加微信
              const noWx = 0;
              this.isAddWeChat = noWx !== wxFlag;
              if (this.isAddWeChat) {
                localStorage.setItem(`user_${window.getUserid()}_added_wechat`, 1);
              } else {
                //用户没添加网销微信，显示导流入口并根据当前日期展示相应文案
                this.weChatText();
                //设置组件曝光埋点
                window.hxmOnceStat(
                  'pdt_pms_269.wxshow',
                  '',
                  {
                    url_ver: 'YRJ-421',
                    pdt_sid: '269',
                  }
                );
              }
            }
          },
          error: () => {
            this.isAddWeChat = true; //如果异常，按添加过微信来处理
          },
        }
        );
      },
      //判断kyc标签是否有效
      judgeKycTag(data, kycTag) {
        if (data[kycTag] && data[kycTag] === '是') {
          return true;
        }
        return false;
      },
      //前往微信小程序承接页引流
      goWeChat() {
        const passParams = {
          id: '465',
          user_id: window.getUserid(),
          business_line: 'yrj',
          page_sign: 'pdt_pms_269.addwechat',
          enter_sign: 'sqprd',
        };
        const pathParams = `enter_sign=${passParams.enter_sign}&page_sign=${passParams.page_sign}&user_id=${passParams.user_id}`;
        const path = `pages/attract/index?business_line=${passParams.business_line}&id=${passParams.id}&${pathParams}`;
        const params = {
          path,
          username: 'gh_f96b4a214761', // 微信小程序原始id，这里跳转的是"同花顺股票小程序"
          miniProgramType: 0, // 0: 正式版 1: 开发版 2: 体验版
        };
        //网页跳转埋点
        window.hxmJumpPageStat(
          'pdt_pms_269.addwechat',
          '',
          {
            url_ver: 'YRJ-421',
            pdt_sid: '269',
          }
        );

        if (window.getPlatform() === 'iphone') {
          window.appToWeixin(params);
        } else{
          new window.Toast('如未跳转，请打开微信');
          window.appToWeixin(params);
        }
      },
      //文案内容
      weChatText() {
        const day = new Date().getDay();
        const showTextCycle = 2;//两条文案轮动的周期
        if (day % showTextCycle === 0) {
          this.dlText = '添加专属产品顾问，领高阶战法';
        } else {
          this.dlText = '添加专属产品顾问，加入决策实战特训营';
        }
      },
      //网销逻辑执行入口
      addWeChatInit() {
        const IfUserAddedWeChat = localStorage.getItem(`user_${window.getUserid()}_added_wechat`);
        if (!IfUserAddedWeChat) {
          this._getAddWechatStatus();
        } else {
          this.isAddWeChat = true;
        }
      },
      //获取跳转埋点相关参数
      validateStat(keyName) {
        if (keyName && window.statConf && window.statConf.stat_collect_sign) {
          return window.statConf.stat_collect_sign[keyName] || '';
        } else {
          return '';
        }
      },
    },
    created: function () {
      $('#initLoading').removeClass('hide')
      var that = this
      that.$watch(
        'stockSearch',
        that.debounce(function (newdata) {
          that.searchStock(newdata)
        }, 200)
      )
    },
    watch: {
      currentTab: function (new1, old1) {
        $(window).scrollTop(0)
      }
    },
    computed: {
      potentialBottomBtn: function() {
        return this.potentialShowLength < this.indexSummaryData.potential.arr.length ? '查看更多' : '收起';
      },
      faucetBottomBtn: function() {
        return this.faucetShowLength < this.indexSummaryData.faucet.arr.length ? '查看更多' : '收起';
      },
      qlgDate: function() {
        var now = new Date();
        if (hour < 15 || (+hour === 15 && minute < 30)) {
          now = new Date(+new Date() - (1000 * 60 * 60 * 24));
        }
        var year = now.getFullYear();
        var month = now.getMonth() + 1;
        var day = now.getDate();
        month < 10 && (month = '0' + month);
        day < 10 && (day = '0' + day);
        var hour = now.getHours();
        var minute = now.getMinutes();
        return {
          tabDate: month + '/' + day,
          updateTime: year + '-' + month + '-' + day
        };
      },
      // 涨停监控页中 潜力个股 tab 上的日期
      qlgTabDate: function() {
        if (this.monitorArr1 && this.monitorArr1.length) {
          return this.monitorArr1[0].date.replace(/\d{4}(\d{2})(\d{2})/, '$1/$2');
        }
        return this.qlgDate.tabDate;
      },
      qlgUpdateTime: function() {
        if (this.monitorArr1 && this.monitorArr1.length) {
          return this.monitorArr1[0].ctime.replace(/(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}):\d{2}/, '$1');
        }
        return this.qlgDate.updateTime + ' 15:30';
      },
      calcBoard1: function () {
        return function (item) {
          if (item.kjb && !item.lt) {
            return '空间'
          } else if (!item.kjb && item.lt) {
            return '龙头'
          } else if (item.kjb && item.lt) {
            return '空间'
          } else {
            return '--'
          }
        }
      },
      calcBoard2: function () {
        return function (item) {
          if (item.wkb) {
            if (item.yzb) {
              return '一字板'
            } else {
              return '未开板'
            }
          } else {
            return '开板'
          }
        }
      },
      calcBoard3: function () {
        var that = this;
        return function (item) {
          var jlr = '';
          
          if (item.jlr != null) {
            jlr = (item.jlr / this.wan).toFixed(2) + '万';
            if(Number(item.jlr) > 0){
              jlr = '<ins class="red">'+jlr+'</ins>';
            } else if(Number(item.jlr) < 0){
              jlr = '<ins class="green">'+jlr+'</ins>';
            } else {
              jlr = '<ins>'+jlr+'</ins>';
            }
          } else {
            jlr = '--';
          }

          var type = that.caclDateType(item.ctime);
          switch(type){
            case '0': // 超过1天/隔日（但为最后一条数据）
              jlr = jlr !== '--' ? jlr : '<ins>未上榜</ins>';
              break;
            case '1': // 超过1天/隔日
              jlr = jlr;
              break;
            case '2': // 当天17:30之后
              jlr = jlr !== '--' ? jlr : '<ins>未上榜</ins>';
              break;
            case '3': // 当天16:30~17:30之间
              jlr = jlr !== '--' ? jlr : '<ins>等待更新</ins>';
              break;
            case '4': // 当天15:30~16:30之间
              jlr = jlr !== '--' ? jlr : '<ins>16:30 更新</ins>';
              break;
            case '5': // 当天15:30之前
              jlr = jlr !== '--' ? jlr : '<ins>16:30 更新</ins>';
              break;
          }

          return jlr;
        }
      }
    },
    filters: {
      kbtsFilter:function(val){
        if(typeof val=='number'){
          return val+"天"
        }else if(val && typeof val=='string'){
          return val
        }else{
          return "--"
        }
      },
      //用于数值或隐式数值类型
      textFilter:function (val,typeTag) {
        if(isNaN(val) || (!val && val != '0')){
          if(val && val != 'NaN'){
            return val
          }else{
            return '--'
          }
        }else{
          if(!typeTag){
            return val
          }else{
            return val + typeTag
          }
        }
      }
    },
    mounted() {
      const that = this;
      //延时执行时间
      const delayTime = 50;
      setTimeout(function () {
        that.listenTabScroll();
        that.listenBottomEvent();
        // 初始化tab
        that.initTab();
        // 获取问财灰度信息
        that.getWencaiConfig();
        // 注册显示和隐藏事件
        that.showHide();
        // 初始化下拉刷新
        that.indexRefresh();
        // 首页接口
        that.getSummaryData().s1(
          function (res) {
            that.getMonitor().first();
            that.getSummaryData().s2(function(){
              that.getSummaryData().s4();
            }, function(){
              that.getSummaryData().s4();
            });
            that.getSummaryData().s3(res);
            thsStats.pageStat('index');
          },
          function () {});
          //执行网销判断逻辑
          that.addWeChatInit();
      }, delayTime);
    },
  })
})